Skip to content

Commit 142f453

Browse files
committed
add tests on running benchmarks with -Z panic-abort-tests
1 parent b82eb28 commit 142f453

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/ui/test-attrs/test-panic-abort.rs

+9
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
// ignore-sgx no subprocess support
1212

1313
#![cfg(test)]
14+
#![feature(test)]
15+
16+
extern crate test;
1417

1518
use std::io::Write;
1619
use std::env;
20+
use test::Bencher;
1721

1822
#[test]
1923
fn it_works() {
@@ -48,3 +52,8 @@ fn no_residual_environment() {
4852
}
4953
}
5054
}
55+
56+
#[bench]
57+
fn benchmark(b: &mut Bencher) {
58+
b.iter(|| assert_eq!(1 + 1, 2));
59+
}

tests/ui/test-attrs/test-panic-abort.run.stdout

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
running 5 tests
2+
running 6 tests
3+
test benchmark ... ok
34
test it_exits ... FAILED
45
test it_fails ... FAILED
56
test it_panics - should panic ... ok
@@ -18,13 +19,13 @@ testing123
1819
testing321
1920
thread 'main' panicked at 'assertion failed: `(left == right)`
2021
left: `2`,
21-
right: `5`', $DIR/test-panic-abort.rs:34:5
22+
right: `5`', $DIR/test-panic-abort.rs:38:5
2223
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2324

2425

2526
failures:
2627
it_exits
2728
it_fails
2829

29-
test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
30+
test result: FAILED. 4 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
3031

0 commit comments

Comments
 (0)