Skip to content
/ rust Public
forked from rust-lang/rust

Commit dc3a586

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

4 files changed

+23
-33
lines changed

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
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+
//@ normalize-stdout: "TypeId\(0x[0-9a-f]+\)" -> "TypeId($$HEX)"
8+
//@ needs-threads
9+
//@ needs-unwind (panic)
710

811
#[test]
912
#[should_panic]
@@ -37,6 +40,7 @@ fn should_panic_with_substring_panics_with_incorrect_string() {
3740

3841
#[test]
3942
#[should_panic = "message"]
43+
#[expect(non_fmt_panics)]
4044
fn should_panic_with_substring_panics_with_non_string_value() {
41-
panic!(123); //~ WARNING panic message is not a string literal
45+
panic!(123);
4246
}
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:14: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:20:5:
7+
message
8+
9+
thread 'should_panic_with_substring_panics_with_incorrect_string' panicked at $DIR/test-should-panic-failed-show-span.rs:38: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:45:5:
13+
Box<dyn Any>

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

+3-9
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,16 @@ 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:25: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:31: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,
28-
found non-string value: `TypeId(0x56ced5e4a15bd89050bb9674fa2df013)`
22+
found non-string value: `TypeId($HEX)`
2923
expected substring: `"message"`
3024

3125
failures:

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

-21
This file was deleted.

0 commit comments

Comments
 (0)