Skip to content

Commit 7cb5be3

Browse files
committed
test(bench): relax compiler panic assertions
1 parent 3f1b828 commit 7cb5be3

File tree

1 file changed

+13
-67
lines changed

1 file changed

+13
-67
lines changed

tests/testsuite/bench.rs

Lines changed: 13 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn cargo_bench_failing_test() {
364364
365365
#[bench]
366366
fn bench_hello(_b: &mut test::Bencher) {
367-
assert_eq!(hello(), "nope")
367+
assert_eq!(hello(), "nope", "NOPE!")
368368
}
369369
"#,
370370
)
@@ -389,28 +389,7 @@ hello
389389
[ERROR] bench failed, to rerun pass `--bin foo`
390390
391391
"#]])
392-
.with_stdout_data(str![[r#"
393-
394-
running 1 test
395-
test bench_hello ... FAILED
396-
397-
failures:
398-
399-
---- bench_hello stdout ----
400-
thread 'main' panicked at src/main.rs:15:17:
401-
assertion `left == right` failed
402-
left: "hello"
403-
right: "nope"
404-
[NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace
405-
406-
407-
failures:
408-
bench_hello
409-
410-
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
411-
412-
413-
"#]])
392+
.with_stdout_data("...\n[..]NOPE![..]\n...")
414393
.with_status(101)
415394
.run();
416395
}
@@ -1439,7 +1418,7 @@ fn test_bench_no_fail_fast() {
14391418
14401419
#[bench]
14411420
fn bench_nope(_b: &mut test::Bencher) {
1442-
assert_eq!("nope", hello())
1421+
assert_eq!("nope", hello(), "NOPE!")
14431422
}
14441423
"#,
14451424
)
@@ -1449,7 +1428,7 @@ fn test_bench_no_fail_fast() {
14491428
#![feature(test)]
14501429
extern crate test;
14511430
#[bench]
1452-
fn b1_fail(_b: &mut test::Bencher) { assert_eq!(1, 2); }
1431+
fn b1_fail(_b: &mut test::Bencher) { assert_eq!(1, 2, "ONE=TWO"); }
14531432
"#,
14541433
)
14551434
.build();
@@ -1468,48 +1447,15 @@ fn test_bench_no_fail_fast() {
14681447
`--bench b1`
14691448
14701449
"#]])
1471-
.with_stdout_data(str![[r#"
1472-
1473-
running 2 tests
1474-
test bench_hello ... bench: [AVG_ELAPSED] ns/iter (+/- [JITTER])
1475-
test bench_nope ... FAILED
1476-
1477-
failures:
1478-
1479-
---- bench_nope stdout ----
1480-
thread 'main' panicked at src/main.rs:20:17:
1481-
assertion `left == right` failed
1482-
left: "nope"
1483-
right: "hello"
1484-
[NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1485-
1486-
1487-
failures:
1488-
bench_nope
1489-
1490-
test result: FAILED. 0 passed; 1 failed; 0 ignored; 1 measured; 0 filtered out; finished in [ELAPSED]s
1491-
1492-
1493-
running 1 test
1494-
test b1_fail ... FAILED
1495-
1496-
failures:
1497-
1498-
---- b1_fail stdout ----
1499-
thread 'main' panicked at benches/b1.rs:5:54:
1500-
assertion `left == right` failed
1501-
left: 1
1502-
right: 2
1503-
[NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1504-
1505-
1506-
failures:
1507-
b1_fail
1508-
1509-
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
1510-
1511-
1512-
"#]])
1450+
.with_stdout_data(
1451+
r#"
1452+
...
1453+
[..]NOPE![..]
1454+
...
1455+
[..]ONE=TWO[..]
1456+
...
1457+
"#,
1458+
)
15131459
.run();
15141460
}
15151461

0 commit comments

Comments
 (0)