Skip to content
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

test: relax assertions of panic message (again) #12500

Merged
merged 1 commit into from
Aug 14, 2023
Merged
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
6 changes: 3 additions & 3 deletions tests/testsuite/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ fn cargo_bench_failing_test() {
[RUNNING] [..] (target/release/deps/foo-[..][EXE])",
)
.with_stdout_contains("[..]thread '[..]' panicked at[..]")
.with_stdout_contains("[..]assertion failed[..]")
.with_stdout_contains("[..]left: `\"hello\"`[..]")
.with_stdout_contains("[..]right: `\"nope\"`[..]")
.with_stdout_contains("[..]assertion [..]failed[..]")
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @weihanglo! Does [..] match .* or .+ (in regex terms)?

Copy link
Member Author

@weihanglo weihanglo Aug 14, 2023

Choose a reason for hiding this comment

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

Yes, similar to .* for a line. Please see https://doc.rust-lang.org/nightly/nightly-rustc/cargo_test_support/compare/index.html.

I am doing this because it need to match both stable and nightly formats to pass Cargo's CI 🥲

.with_stdout_contains("[..]left: [..]\"hello\"[..]")
.with_stdout_contains("[..]right: [..]\"nope\"[..]")
.with_stdout_contains("[..]src/main.rs:15[..]")
.with_status(101)
.run();
Expand Down
8 changes: 4 additions & 4 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ failures:
---- test_hello stdout ----
[..]thread '[..]' panicked at [..]",
)
.with_stdout_contains("[..]assertion failed[..]")
.with_stdout_contains("[..]`(left == right)`[..]")
.with_stdout_contains("[..]left: `\"hello\"`,[..]")
.with_stdout_contains("[..]right: `\"nope\"`[..]")
.with_stdout_contains("[..]assertion [..]failed[..]")
.with_stdout_contains("[..]left == right[..]")
.with_stdout_contains("[..]left: [..]\"hello\"[..]")
.with_stdout_contains("[..]right: [..]\"nope\"[..]")
.with_stdout_contains("[..]src/main.rs:12[..]")
.with_stdout_contains(
"\
Expand Down