Skip to content

Commit

Permalink
fixup! test: migrate test to snapbox
Browse files Browse the repository at this point in the history
  • Loading branch information
eth3lbert committed Jul 10, 2024
1 parent d4d2f8c commit 6162cf5
Showing 1 changed file with 7 additions and 27 deletions.
34 changes: 7 additions & 27 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1880,14 +1880,8 @@ fn test_run_implicit_example_target() {

// Compiles myexm1 as normal, but does not run it.
prj.cargo("test -v")
.with_stderr_data(
str![[r#"
[RUNNING] `rustc [..]myexm1.rs [..]--crate-type bin[..]`
[RUNNING] `rustc [..]myexm2.rs [..]--test[..]`
...
"#]]
.unordered(),
)
.with_stderr_contains("[RUNNING] `rustc [..]myexm1.rs [..]--crate-type bin[..]")
.with_stderr_contains("[RUNNING] `rustc [..]myexm2.rs [..]--test[..]")
.with_stderr_does_not_contain("[RUNNING] [..]myexm1-[..]")
.with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm2-[..]")
.run();
Expand Down Expand Up @@ -2875,14 +2869,6 @@ test sub_one_test ... ok
test [..] ... ok
...
"#]].unordered())
// .with_stdout_data(str![[r#"
// running 0 tests
// test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
// test sub_one_test ... ok
// test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
// test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
// ...
// "#]].unordered())
.run();
}

Expand Down Expand Up @@ -3932,15 +3918,9 @@ fn cargo_test_env() {
.build();

let cargo = cargo_exe().canonicalize().unwrap();
let cargo = cargo.to_str().unwrap();
#[allow(deprecated)]
p.cargo("test --lib -- --nocapture")
.with_stderr_data(format!(
"\
...
{cargo}
...
"
))
.with_stderr_contains(cargo.to_str().unwrap())
.with_stdout_data(str![[r#"
...
test env_test ... ok
Expand Down Expand Up @@ -5467,7 +5447,7 @@ fn nonzero_exit_status() {
.with_stderr_data(str![[r#"
[COMPILING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[RUNNING] tests/t1.rs (target/debug/deps/t1-[HASH])
[RUNNING] tests/t1.rs (target/debug/deps/t1-[HASH][EXE])
[ERROR] test failed, to rerun pass `--test t1`
"#]])
Expand All @@ -5483,11 +5463,11 @@ this is a normal error
.with_stderr_data(str![[r#"
[COMPILING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[RUNNING] tests/t2.rs (target/debug/deps/t2-[HASH])
[RUNNING] tests/t2.rs (target/debug/deps/t2-[HASH][EXE])
[ERROR] test failed, to rerun pass `--test t2`
Caused by:
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH]` ([EXIT_STATUS]: 4)
process didn't exit successfully: `[ROOT]/foo/target/debug/deps/t2-[HASH][EXE]` ([EXIT_STATUS]: 4)
[NOTE] test exited abnormally; to see the full output pass --nocapture to the harness.
"#]])
Expand Down

0 comments on commit 6162cf5

Please sign in to comment.