Skip to content

Commit aca04d9

Browse files
committed
Adjust test directives
Signed-off-by: xizheyin <[email protected]>
1 parent 0a6e378 commit aca04d9

4 files changed

+21
-32
lines changed

Diff for: tests/ui/test-attrs/test-should-panic-failed-show-span.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
//@ compile-flags: --test
2+
//@ run-flags: --test-threads=1 --nocapture
13
//@ run-fail
24
//@ check-run-results
3-
//@ compile-flags: --test
45
//@ exec-env:RUST_BACKTRACE=0
56
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
6-
//@ run-flags: --test-threads=1
7+
//@ needs-threads
8+
//@ needs-unwind (panic)
79

810
#[test]
911
#[should_panic]
@@ -37,6 +39,7 @@ fn should_panic_with_substring_panics_with_incorrect_string() {
3739

3840
#[test]
3941
#[should_panic = "message"]
42+
#[expect(non_fmt_panics)]
4043
fn should_panic_with_substring_panics_with_non_string_value() {
41-
panic!(123); //~ WARNING panic message is not a string literal
44+
panic!(123);
4245
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
thread 'should_panic_with_any_message' panicked at $DIR/test-should-panic-failed-show-span.rs:13:5:
3+
Panic!
4+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
5+
6+
thread 'should_panic_with_message' panicked at $DIR/test-should-panic-failed-show-span.rs:19:5:
7+
message
8+
9+
thread 'should_panic_with_substring_panics_with_incorrect_string' panicked at $DIR/test-should-panic-failed-show-span.rs:37:5:
10+
ZOMGWTFBBQ
11+
12+
thread 'should_panic_with_substring_panics_with_non_string_value' panicked at $DIR/test-should-panic-failed-show-span.rs:44:5:
13+
Box<dyn Any>

Diff for: tests/ui/test-attrs/test-should-panic-failed-show-span.run.stdout

+2-8
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,14 @@ test should_panic_with_substring_panics_with_non_string_value - should panic ...
1010
failures:
1111

1212
---- should_panic_with_any_message_does_not_panic stdout ----
13-
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:22:4
13+
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:24:4
1414
---- should_panic_with_message_does_not_panic stdout ----
15-
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:28:4
15+
note: test did not panic as expected at $DIR/test-should-panic-failed-show-span.rs:30:4
1616
---- should_panic_with_substring_panics_with_incorrect_string stdout ----
17-
18-
thread 'should_panic_with_substring_panics_with_incorrect_string' panicked at $DIR/test-should-panic-failed-show-span.rs:35:5:
19-
ZOMGWTFBBQ
2017
note: panic did not contain expected string
2118
panic message: `"ZOMGWTFBBQ"`,
2219
expected substring: `"message"`
2320
---- should_panic_with_substring_panics_with_non_string_value stdout ----
24-
25-
thread 'should_panic_with_substring_panics_with_non_string_value' panicked at $DIR/test-should-panic-failed-show-span.rs:41:5:
26-
Box<dyn Any>
2721
note: expected panic with string value,
2822
found non-string value: `TypeId(0x56ced5e4a15bd89050bb9674fa2df013)`
2923
expected substring: `"message"`

Diff for: tests/ui/test-attrs/test-should-panic-failed-show-span.stderr

-21
This file was deleted.

0 commit comments

Comments
 (0)