Skip to content

Commit 6162cf5

Browse files
committed
fixup! test: migrate test to snapbox
1 parent d4d2f8c commit 6162cf5

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

tests/testsuite/test.rs

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,14 +1880,8 @@ fn test_run_implicit_example_target() {
18801880

18811881
// Compiles myexm1 as normal, but does not run it.
18821882
prj.cargo("test -v")
1883-
.with_stderr_data(
1884-
str![[r#"
1885-
[RUNNING] `rustc [..]myexm1.rs [..]--crate-type bin[..]`
1886-
[RUNNING] `rustc [..]myexm2.rs [..]--test[..]`
1887-
...
1888-
"#]]
1889-
.unordered(),
1890-
)
1883+
.with_stderr_contains("[RUNNING] `rustc [..]myexm1.rs [..]--crate-type bin[..]")
1884+
.with_stderr_contains("[RUNNING] `rustc [..]myexm2.rs [..]--test[..]")
18911885
.with_stderr_does_not_contain("[RUNNING] [..]myexm1-[..]")
18921886
.with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm2-[..]")
18931887
.run();
@@ -2875,14 +2869,6 @@ test sub_one_test ... ok
28752869
test [..] ... ok
28762870
...
28772871
"#]].unordered())
2878-
// .with_stdout_data(str![[r#"
2879-
// running 0 tests
2880-
// test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
2881-
// test sub_one_test ... ok
2882-
// test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
2883-
// test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
2884-
// ...
2885-
// "#]].unordered())
28862872
.run();
28872873
}
28882874

@@ -3932,15 +3918,9 @@ fn cargo_test_env() {
39323918
.build();
39333919

39343920
let cargo = cargo_exe().canonicalize().unwrap();
3935-
let cargo = cargo.to_str().unwrap();
3921+
#[allow(deprecated)]
39363922
p.cargo("test --lib -- --nocapture")
3937-
.with_stderr_data(format!(
3938-
"\
3939-
...
3940-
{cargo}
3941-
...
3942-
"
3943-
))
3923+
.with_stderr_contains(cargo.to_str().unwrap())
39443924
.with_stdout_data(str![[r#"
39453925
...
39463926
test env_test ... ok
@@ -5467,7 +5447,7 @@ fn nonzero_exit_status() {
54675447
.with_stderr_data(str![[r#"
54685448
[COMPILING] foo v0.0.1 ([ROOT]/foo)
54695449
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
5470-
[RUNNING] tests/t1.rs (target/debug/deps/t1-[HASH])
5450+
[RUNNING] tests/t1.rs (target/debug/deps/t1-[HASH][EXE])
54715451
[ERROR] test failed, to rerun pass `--test t1`
54725452
54735453
"#]])
@@ -5483,11 +5463,11 @@ this is a normal error
54835463
.with_stderr_data(str![[r#"
54845464
[COMPILING] foo v0.0.1 ([ROOT]/foo)
54855465
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
5486-
[RUNNING] tests/t2.rs (target/debug/deps/t2-[HASH])
5466+
[RUNNING] tests/t2.rs (target/debug/deps/t2-[HASH][EXE])
54875467
[ERROR] test failed, to rerun pass `--test t2`
54885468
54895469
Caused by:
5490-
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH]` ([EXIT_STATUS]: 4)
5470+
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE]` ([EXIT_STATUS]: 4)
54915471
[NOTE] test exited abnormally; to see the full output pass --nocapture to the harness.
54925472
54935473
"#]])

0 commit comments

Comments
 (0)