Fix failing cranelift-object tests: make panic message match more generic. (#4211)

Rust 1.61 changed the way `Debug` output looks for strings with null
bytes in them, which broke some expected-panic error message matches.
This makes the expectations more generic while still capturing the
important part ("has a null byte").
This commit is contained in:
Chris Fallin
2022-06-02 13:34:10 -07:00
committed by GitHub
parent 9f5f978baa
commit 44d1dee76e

View File

@@ -199,9 +199,7 @@ fn libcall_function() {
}
#[test]
#[should_panic(
expected = "Result::unwrap()` on an `Err` value: Backend(Symbol \"function\\0with\\0nul\\0bytes\" has a null byte, which is disallowed"
)]
#[should_panic(expected = "has a null byte, which is disallowed")]
fn reject_nul_byte_symbol_for_func() {
let flag_builder = settings::builder();
let isa_builder = cranelift_codegen::isa::lookup_by_name("x86_64-unknown-linux-gnu").unwrap();
@@ -223,9 +221,7 @@ fn reject_nul_byte_symbol_for_func() {
}
#[test]
#[should_panic(
expected = "Result::unwrap()` on an `Err` value: Backend(Symbol \"data\\0with\\0nul\\0bytes\" has a null byte, which is disallowed"
)]
#[should_panic(expected = "has a null byte, which is disallowed")]
fn reject_nul_byte_symbol_for_data() {
let flag_builder = settings::builder();
let isa_builder = cranelift_codegen::isa::lookup_by_name("x86_64-unknown-linux-gnu").unwrap();