diff options
| author | Lieselotte <52315535+she3py@users.noreply.github.com> | 2025-04-28 21:40:29 +0200 |
|---|---|---|
| committer | Lieselotte <52315535+she3py@users.noreply.github.com> | 2025-04-28 21:40:29 +0200 |
| commit | 55a419f444378afb5eceb361959fa57eefce2be1 (patch) | |
| tree | 442c78cb18e93343ede27612da16757d72caf1d3 | |
| parent | 7d65abfe80f9eee93296d1ce08f845c9bf7039f8 (diff) | |
| download | rust-55a419f444378afb5eceb361959fa57eefce2be1.tar.gz rust-55a419f444378afb5eceb361959fa57eefce2be1.zip | |
Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg`
| -rw-r--r-- | library/test/src/test_result.rs | 9 | ||||
| -rw-r--r-- | library/test/src/tests.rs | 6 | ||||
| -rw-r--r-- | tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout | 6 |
3 files changed, 10 insertions, 11 deletions
diff --git a/library/test/src/test_result.rs b/library/test/src/test_result.rs index a312894c25c..4cb43fc45fd 100644 --- a/library/test/src/test_result.rs +++ b/library/test/src/test_result.rs @@ -61,16 +61,15 @@ pub(crate) fn calc_result( } else if let Some(panic_str) = maybe_panic_str { TestResult::TrFailedMsg(format!( r#"panic did not contain expected string - panic message: `{panic_str:?}`, - expected substring: `{msg:?}`"# + panic message: {panic_str:?} + expected substring: {msg:?}"# )) } else { TestResult::TrFailedMsg(format!( r#"expected panic with string value, found non-string value: `{:?}` - expected substring: `{:?}`"#, - (*err).type_id(), - msg + expected substring: {msg:?}"#, + (*err).type_id() )) } } diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs index 47f581fefae..d986bd74f77 100644 --- a/library/test/src/tests.rs +++ b/library/test/src/tests.rs @@ -200,8 +200,8 @@ fn test_should_panic_bad_message() { } let expected = "foobar"; let failed_msg = r#"panic did not contain expected string - panic message: `"an error message"`, - expected substring: `"foobar"`"#; + panic message: "an error message" + expected substring: "foobar""#; let desc = TestDescAndFn { desc: TestDesc { name: StaticTestName("whatever"), @@ -238,7 +238,7 @@ fn test_should_panic_non_string_message_type() { let failed_msg = format!( r#"expected panic with string value, found non-string value: `{:?}` - expected substring: `"foobar"`"#, + expected substring: "foobar""#, TypeId::of::<i32>() ); let desc = TestDescAndFn { diff --git a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout index 75600b4d3d6..93204abb968 100644 --- a/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout +++ b/tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout @@ -15,12 +15,12 @@ note: test did not panic as expected at $DIR/test-should-panic-failed-show-span. note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:31:4 ---- should_panic_with_substring_panics_with_incorrect_string stdout ---- note: panic did not contain expected string - panic message: `"ZOMGWTFBBQ"`, - expected substring: `"message"` + panic message: "ZOMGWTFBBQ" + expected substring: "message" ---- should_panic_with_substring_panics_with_non_string_value stdout ---- note: expected panic with string value, found non-string value: `TypeId($HEX)` - expected substring: `"message"` + expected substring: "message" failures: should_panic_with_any_message_does_not_panic |
