Skip to content

Remove backticks from ShouldPanic::YesWithMessage's TrFailedMsg #136160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions library/test/src/test_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
))
}
}
Expand Down
6 changes: 3 additions & 3 deletions library/test/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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 {
Expand Down
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blessed this file (from PR #138603.)
@rustbot ready

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading