Skip to content

Commit 1f2e704

Browse files
committed
also test built-in panics via should_panic
1 parent 8b2d1cc commit 1f2e704

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

test-cargo-miri/test.stdout.ref

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ test test::rng ... ok
55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
66

77

8-
running 5 tests
8+
running 6 tests
99
test do_panic ... ok
1010
test entropy_rng ... ok
11+
test fail_index_check ... ok
1112
test num_cpus ... ok
1213
test simple1 ... ok
1314
test simple2 ... ok
1415

15-
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
16+
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
1617

test-cargo-miri/test.stdout.ref2

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out
77
running 1 test
88
test simple1 ... ok
99

10-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out
10+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out
1111

test-cargo-miri/test.stdout.ref3

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out
77
running 1 test
88
test num_cpus ... ok
99

10-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out
10+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out
1111

test-cargo-miri/tests/test.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn num_cpus() {
4343
}
4444

4545

46-
// FIXME: Remove this `cfg` once we fix https://github.com/rust-lang/miri/issues/1059
46+
// FIXME: Remove this `cfg` once we fix https://github.com/rust-lang/miri/issues/1059.
4747
// We cfg-gate the `should_panic` attribute and the `panic!` itself, so that the test
4848
// stdout does not depend on the platform
4949
#[test]
@@ -52,3 +52,12 @@ fn do_panic() { // In large, friendly letters :)
5252
#[cfg(not(windows))]
5353
panic!("Explicit panic from test!");
5454
}
55+
56+
// FIXME: see above
57+
#[test]
58+
#[allow(const_error)]
59+
#[cfg_attr(not(windows), should_panic(expected="len is 0 but index is 42"))]
60+
fn fail_index_check() {
61+
#[cfg(not(windows))]
62+
[][42]
63+
}

0 commit comments

Comments
 (0)