Skip to content

Commit e965b41

Browse files
committed
test(test): relax compiler panic assertions
1 parent c3a74f5 commit e965b41

File tree

1 file changed

+13
-39
lines changed

1 file changed

+13
-39
lines changed

tests/testsuite/test.rs

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ fn cargo_test_failing_test_in_bin() {
396396
397397
#[test]
398398
fn test_hello() {
399-
assert_eq!(hello(), "nope")
399+
assert_eq!(hello(), "nope", "NOPE!")
400400
}
401401
"#,
402402
)
@@ -420,24 +420,7 @@ hello
420420
[ERROR] test failed, to rerun pass `--bin foo`
421421
422422
"#]])
423-
.with_stdout_data(
424-
str![[r#"
425-
running 1 test
426-
test test_hello ... FAILED
427-
428-
failures:
429-
430-
---- test_hello stdout ----
431-
thread 'test_hello' panicked at src/main.rs:12:17:
432-
assertion `left == right` failed
433-
left: "hello"
434-
right: "nope"
435-
failures:
436-
test_hello
437-
...
438-
"#]]
439-
.unordered(),
440-
)
423+
.with_stdout_data("...\n[..]NOPE![..]\n...")
441424
.with_status(101)
442425
.run();
443426
}
@@ -449,7 +432,7 @@ fn cargo_test_failing_test_in_test() {
449432
.file("src/main.rs", r#"pub fn main() { println!("hello"); }"#)
450433
.file(
451434
"tests/footest.rs",
452-
"#[test] fn test_hello() { assert!(false) }",
435+
r#"#[test] fn test_hello() { assert!(false, "FALSE!") }"#,
453436
)
454437
.build();
455438

@@ -476,17 +459,13 @@ hello
476459
str![[r#"
477460
...
478461
running 0 tests
462+
...
479463
running 1 test
480464
test test_hello ... FAILED
481-
482-
failures:
483-
484-
---- test_hello stdout ----
485-
thread 'test_hello' panicked at tests/footest.rs:1:27:
486-
assertion failed: false
487-
failures:
488-
test_hello
489465
...
466+
[..]FALSE![..]
467+
...
468+
490469
"#]]
491470
.unordered(),
492471
)
@@ -498,7 +477,10 @@ failures:
498477
fn cargo_test_failing_test_in_lib() {
499478
let p = project()
500479
.file("Cargo.toml", &basic_lib_manifest("foo"))
501-
.file("src/lib.rs", "#[test] fn test_hello() { assert!(false) }")
480+
.file(
481+
"src/lib.rs",
482+
r#"#[test] fn test_hello() { assert!(false, "FALSE!") }"#,
483+
)
502484
.build();
503485

504486
p.cargo("test")
@@ -512,16 +494,8 @@ fn cargo_test_failing_test_in_lib() {
512494
.with_stdout_data(str![[r#"
513495
...
514496
test test_hello ... FAILED
515-
516-
failures:
517-
518-
---- test_hello stdout ----
519-
...
520-
thread 'test_hello' panicked at src/lib.rs:1:27:
521-
assertion failed: false
522497
...
523-
failures:
524-
test_hello
498+
[..]FALSE![..]
525499
...
526500
"#]])
527501
.with_status(101)
@@ -5528,7 +5502,7 @@ Caused by:
55285502
"test exited abnormally; to see the full output pass --nocapture to the harness.",
55295503
)
55305504
.with_stderr_data(str![[r#"
5531-
thread 't' panicked at tests/t1.rs:3:26:
5505+
[..]thread [..]panicked [..] tests/t1.rs[..]
55325506
[NOTE] run with `RUST_BACKTRACE=1` environment variable to display a backtrace
55335507
Caused by:
55345508
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE] --nocapture` ([EXIT_STATUS]: 4)

0 commit comments

Comments
 (0)