diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index a20cd86a7b4..0441f0a660c 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -93,13 +93,13 @@ call to `execs()`: // Before assert_that( p.cargo("run"), - execs().with_status(0) + execs() ); // After assert_that( p.cargo("run"), - execs().stream().with_status(0) + execs().stream() ); ``` diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs index 40296b4181e..33c12aa13ad 100644 --- a/tests/testsuite/alt_registry.rs +++ b/tests/testsuite/alt_registry.rs @@ -59,7 +59,7 @@ fn depend_on_alt_registry() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [DOWNLOADING] bar v0.0.1 (registry `file://[..]`) @@ -74,13 +74,13 @@ fn depend_on_alt_registry() { assert_that( p.cargo("clean").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); // Don't download a second time assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] bar v0.0.1 (registry `file://[..]`) [COMPILING] foo v0.0.1 ({dir}) @@ -120,7 +120,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) @@ -165,7 +165,7 @@ fn depend_on_alt_registry_depends_on_same_registry() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) @@ -210,7 +210,7 @@ fn depend_on_alt_registry_depends_on_crates_io() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{alt_reg}` [UPDATING] registry `{reg}` @@ -255,7 +255,7 @@ fn registry_and_path_dep_works() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] bar v0.0.1 ({dir}/bar) [COMPILING] foo v0.0.1 ({dir}) @@ -355,7 +355,7 @@ fn publish_with_registry_dependency() { .arg("alternative") .arg("TOKEN") .arg("-Zunstable-options"), - execs().with_status(0), + execs(), ); assert_that( @@ -364,7 +364,7 @@ fn publish_with_registry_dependency() { .arg("--registry") .arg("alternative") .arg("-Zunstable-options"), - execs().with_status(0), + execs(), ); } @@ -400,7 +400,6 @@ fn alt_registry_and_crates_io_deps() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_contains(format!( "[UPDATING] registry `{}`", registry::alt_registry() @@ -467,7 +466,7 @@ fn publish_to_alt_registry() { .arg("alternative") .arg("TOKEN") .arg("-Zunstable-options"), - execs().with_status(0), + execs(), ); // Now perform the actual publish @@ -477,7 +476,7 @@ fn publish_to_alt_registry() { .arg("--registry") .arg("alternative") .arg("-Zunstable-options"), - execs().with_status(0), + execs(), ); // Ensure that the crate is uploaded @@ -516,7 +515,7 @@ fn publish_with_crates_io_dep() { .arg("alternative") .arg("TOKEN") .arg("-Zunstable-options"), - execs().with_status(0), + execs(), ); assert_that( @@ -525,7 +524,7 @@ fn publish_with_crates_io_dep() { .arg("--registry") .arg("alternative") .arg("-Zunstable-options"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index 5137317f9b0..749eaf4e890 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -175,7 +175,7 @@ fn default_cargo_config_jobs() { "#, ) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -190,7 +190,7 @@ fn good_cargo_config_jobs() { "#, ) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -371,7 +371,7 @@ fn bad_dependency_in_lockfile() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -683,7 +683,7 @@ fn unused_keys() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: unused manifest key: target.foo.bar [COMPILING] foo v0.1.0 (file:///[..]) @@ -710,7 +710,7 @@ warning: unused manifest key: target.foo.bar assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: unused manifest key: profile.debug warning: use `[profile.dev]` to configure debug builds @@ -735,7 +735,7 @@ warning: use `[profile.dev]` to configure debug builds .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: unused manifest key: project.bulid [COMPILING] foo [..] @@ -763,7 +763,7 @@ warning: unused manifest key: project.bulid .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: unused manifest key: lib.build [COMPILING] foo [..] @@ -789,7 +789,7 @@ fn unused_keys_in_virtual_manifest() { .build(); assert_that( p.cargo("build --all"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: unused manifest key: workspace.bulid [COMPILING] bar [..] @@ -821,7 +821,7 @@ fn empty_dependencies() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ warning: dependency (bar) specified without providing a local path, Git repository, or version \ to use. This will be considered an error in future versions @@ -839,7 +839,7 @@ fn invalid_toml_historically_allowed_is_warned() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: TOML file found which contains invalid syntax and will soon not parse at `[..]config`. @@ -877,7 +877,7 @@ fn ambiguous_git_reference() { assert_that( p.cargo("build").arg("-v"), - execs().with_stderr_contains( + execs().with_status(101).with_stderr_contains( "\ [WARNING] dependency (bar) specification is ambiguous. \ Only one of `branch`, `tag` or `rev` is allowed. \ @@ -1097,7 +1097,7 @@ fn both_git_and_path_specified() { assert_that( foo.cargo("build").arg("-v"), - execs().with_stderr_contains( + execs().with_status(101).with_stderr_contains( "\ [WARNING] dependency (bar) specification is ambiguous. \ Only one of `git` or `path` is allowed. \ @@ -1162,7 +1162,7 @@ fn ignored_git_revision() { assert_that( foo.cargo("build").arg("-v"), - execs().with_stderr_contains( + execs().with_status(101).with_stderr_contains( "\ [WARNING] key `branch` is ignored for dependency (bar). \ This will be considered an error in future versions", diff --git a/tests/testsuite/bench.rs b/tests/testsuite/bench.rs index 9306ce261a1..57185adcbdd 100644 --- a/tests/testsuite/bench.rs +++ b/tests/testsuite/bench.rs @@ -90,7 +90,6 @@ fn bench_bench_implicit() { assert_that( p.cargo("bench").arg("--benches"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -139,7 +138,6 @@ fn bench_bin_implicit() { assert_that( p.cargo("bench").arg("--bins"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -178,7 +176,6 @@ fn bench_tarname() { assert_that( p.cargo("bench").arg("--bench").arg("bin2"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -228,7 +225,6 @@ fn bench_multiple_targets() { .arg("--bench") .arg("bin2"), execs() - .with_status(0) .with_stdout_contains("test run1 ... bench: [..]") .with_stdout_contains("test run2 ... bench: [..]") .with_stdout_does_not_contain("[..]run3[..]"), @@ -509,7 +505,6 @@ fn bench_with_deep_lib_dep() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ([..]) @@ -727,7 +722,7 @@ fn dont_run_examples() { r#"fn main() { panic!("Examples should not be run by 'cargo test'"); }"#, ) .build(); - assert_that(p.cargo("bench"), execs().with_status(0)); + assert_that(p.cargo("bench"), execs()); } #[test] @@ -753,7 +748,6 @@ fn pass_through_command_line() { assert_that( p.cargo("bench").arg("bar"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -767,7 +761,6 @@ fn pass_through_command_line() { assert_that( p.cargo("bench").arg("foo"), execs() - .with_status(0) .with_stderr( "[FINISHED] release [optimized] target(s) in [..] [RUNNING] target/release/deps/foo-[..][EXE]", @@ -803,7 +796,7 @@ fn cargo_bench_twice() { p.cargo("build"); for _ in 0..2 { - assert_that(p.cargo("bench"), execs().with_status(0)); + assert_that(p.cargo("bench"), execs()); } } @@ -907,7 +900,6 @@ fn lib_with_standard_name() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] syntax v0.0.1 ({dir}) @@ -963,7 +955,6 @@ fn lib_with_standard_name2() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] syntax v0.0.1 ({dir}) @@ -1042,7 +1033,6 @@ fn bench_dylib() { assert_that( p.cargo("bench").arg("-v"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] bar v0.0.1 ({dir}/bar) @@ -1063,7 +1053,6 @@ fn bench_dylib() { assert_that( p.cargo("bench").arg("-v"), execs() - .with_status(0) .with_stderr(&format!( "\ [FRESH] bar v0.0.1 ({dir}/bar) @@ -1110,7 +1099,6 @@ fn bench_twice_with_build_cmd() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1124,7 +1112,6 @@ fn bench_twice_with_build_cmd() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr( "[FINISHED] release [optimized] target(s) in [..] [RUNNING] target/release/deps/foo-[..][EXE]", @@ -1207,7 +1194,6 @@ fn bench_with_examples() { assert_that( p.cargo("bench").arg("-v"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v6.6.6 ({url}) @@ -1257,7 +1243,6 @@ fn test_a_bench() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.1.0 ([..]) @@ -1293,7 +1278,7 @@ fn test_bench_no_run() { assert_that( p.cargo("bench").arg("--no-run"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] release [optimized] target(s) in [..] @@ -1437,7 +1422,6 @@ fn test_bench_multiple_packages() { assert_that( p.cargo("bench").arg("-p").arg("bar").arg("-p").arg("baz"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] target/release/deps/bbaz-[..][EXE]") .with_stdout_contains("test bench_baz ... bench: [..]") .with_stderr_contains("[RUNNING] target/release/deps/bbar-[..][EXE]") @@ -1497,7 +1481,6 @@ fn bench_all_workspace() { assert_that( p.cargo("bench").arg("--all"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] target/release/deps/bar-[..][EXE]") .with_stdout_contains("test bench_bar ... bench: [..]") .with_stderr_contains("[RUNNING] target/release/deps/foo-[..][EXE]") @@ -1544,7 +1527,7 @@ fn bench_all_exclude() { assert_that( p.cargo("bench").arg("--all").arg("--exclude").arg("baz"), - execs().with_status(0).with_stdout_contains( + execs().with_stdout_contains( "\ running 1 test test bar ... bench: [..] ns/iter (+/- [..])", @@ -1600,7 +1583,6 @@ fn bench_all_virtual_manifest() { assert_that( p.cargo("bench").arg("--all"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] target/release/deps/baz-[..][EXE]") .with_stdout_contains("test bench_baz ... bench: [..]") .with_stderr_contains("[RUNNING] target/release/deps/bar-[..][EXE]") @@ -1644,7 +1626,7 @@ fn legacy_bench_name() { assert_that( p.cargo("bench"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] path `[..]src/bench.rs` was erroneously implicitly accepted for benchmark `bench`, please set bench.path in Cargo.toml", @@ -1697,7 +1679,6 @@ fn bench_virtual_manifest_all_implied() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] target/release/deps/baz-[..][EXE]") .with_stdout_contains("test bench_baz ... bench: [..]") .with_stderr_contains("[RUNNING] target/release/deps/bar-[..][EXE]") diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 28355c1c495..e9f5ce9cc65 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -19,12 +19,12 @@ fn cargo_compile_simple() { .file("src/foo.rs", &main_file(r#""i am foo""#, &[])) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("i am foo\n"), + execs().with_stdout("i am foo\n"), ); } @@ -53,20 +53,16 @@ fn cargo_compile_incremental() { assert_that( p.cargo("build").arg("-v").env("CARGO_INCREMENTAL", "1"), - execs() - .with_stderr_contains( - "[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n", - ) - .with_status(0), + execs().with_stderr_contains( + "[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n", + ) ); assert_that( p.cargo("test").arg("-v").env("CARGO_INCREMENTAL", "1"), - execs() - .with_stderr_contains( - "[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n", - ) - .with_status(0), + execs().with_stderr_contains( + "[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n", + ) ); } @@ -93,16 +89,12 @@ fn incremental_profile() { assert_that( p.cargo("build").arg("-v").env_remove("CARGO_INCREMENTAL"), - execs() - .with_stderr_does_not_contain("[..]C incremental=[..]") - .with_status(0), + execs().with_stderr_does_not_contain("[..]C incremental=[..]"), ); assert_that( p.cargo("build").arg("-v").env("CARGO_INCREMENTAL", "1"), - execs() - .with_stderr_contains("[..]C incremental=[..]") - .with_status(0), + execs().with_stderr_contains("[..]C incremental=[..]"), ); assert_that( @@ -110,9 +102,7 @@ fn incremental_profile() { .arg("--release") .arg("-v") .env_remove("CARGO_INCREMENTAL"), - execs() - .with_stderr_contains("[..]C incremental=[..]") - .with_status(0), + execs().with_stderr_contains("[..]C incremental=[..]"), ); assert_that( @@ -120,9 +110,7 @@ fn incremental_profile() { .arg("--release") .arg("-v") .env("CARGO_INCREMENTAL", "0"), - execs() - .with_stderr_does_not_contain("[..]C incremental=[..]") - .with_status(0), + execs().with_stderr_does_not_contain("[..]C incremental=[..]"), ); } @@ -142,15 +130,12 @@ fn incremental_config() { assert_that( p.cargo("build").arg("-v").env_remove("CARGO_INCREMENTAL"), execs() - .with_stderr_does_not_contain("[..]C incremental=[..]") - .with_status(0), + .with_stderr_does_not_contain("[..]C incremental=[..]"), ); assert_that( p.cargo("build").arg("-v").env("CARGO_INCREMENTAL", "1"), - execs() - .with_stderr_contains("[..]C incremental=[..]") - .with_status(0), + execs().with_stderr_contains("[..]C incremental=[..]"), ); } @@ -181,7 +166,7 @@ fn cargo_compile_manifest_path() { .arg("--manifest-path") .arg("foo/Cargo.toml") .cwd(p.root().parent().unwrap()), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); } @@ -279,7 +264,7 @@ fn cargo_compile_duplicate_build_targets() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: file found to be present in multiple build targets: [..]main.rs [COMPILING] foo v0.0.1 ([..]) @@ -553,7 +538,6 @@ fn cargo_compile_with_warnings_in_the_root_package() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr_contains("[..]function is never used: `dead`[..]"), ); } @@ -595,7 +579,6 @@ fn cargo_compile_with_warnings_in_a_dep_package() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr_contains("[..]function is never used: `dead`[..]"), ); @@ -603,7 +586,7 @@ fn cargo_compile_with_warnings_in_a_dep_package() { assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("test passed\n"), + execs().with_stdout("test passed\n"), ); } @@ -669,7 +652,7 @@ fn cargo_compile_with_nested_deps_inferred() { assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("test passed\n"), + execs().with_stdout("test passed\n"), ); } @@ -735,7 +718,7 @@ fn cargo_compile_with_nested_deps_correct_bin() { assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("test passed\n"), + execs().with_stdout("test passed\n"), ); } @@ -802,7 +785,7 @@ fn cargo_compile_with_nested_deps_shorthand() { assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("test passed\n"), + execs().with_stdout("test passed\n"), ); } @@ -875,7 +858,7 @@ fn cargo_compile_with_nested_deps_longhand() { assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("test passed\n"), + execs().with_stdout("test passed\n"), ); } @@ -992,7 +975,7 @@ fn cargo_compile_path_with_offline() { p.cargo("build") .masquerade_as_nightly_cargo() .arg("-Zoffline"), - execs().with_status(0), + execs(), ); } @@ -1019,7 +1002,7 @@ fn cargo_compile_with_downloaded_dependency_with_offline() { ) .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } let p2 = project().at("bar") @@ -1041,7 +1024,7 @@ fn cargo_compile_with_downloaded_dependency_with_offline() { p2.cargo("build") .masquerade_as_nightly_cargo() .arg("-Zoffline"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] present_dep v1.2.3 [COMPILING] bar v0.1.0 ([..]) @@ -1115,7 +1098,7 @@ fn compile_offline_without_maxvers_cached() { ) .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } let p2 = project() @@ -1145,7 +1128,6 @@ fn main(){ .masquerade_as_nightly_cargo() .arg("-Zoffline"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] present_dep v1.2.3 @@ -1330,14 +1312,14 @@ fn compile_path_dep_then_change_version() { .file("bar/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); File::create(&p.root().join("bar/Cargo.toml")) .unwrap() .write_all(basic_manifest("bar", "0.0.2").as_bytes()) .unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1347,7 +1329,7 @@ fn ignores_carriage_return_in_lockfile() { .file("src/a.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let lockfile = p.root().join("Cargo.lock"); let mut lock = String::new(); @@ -1360,7 +1342,7 @@ fn ignores_carriage_return_in_lockfile() { .unwrap() .write_all(lock.as_bytes()) .unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1400,7 +1382,7 @@ fn cargo_default_env_metadata_env_var() { // No metadata on libbar since it's a dylib path dependency assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] bar v0.0.1 ({url}/bar) [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type dylib \ @@ -1425,14 +1407,14 @@ fn cargo_default_env_metadata_env_var() { )), ); - assert_that(p.cargo("clean"), execs().with_status(0)); + assert_that(p.cargo("clean"), execs()); // If you set the env-var, then we expect metadata on libbar assert_that( p.cargo("build") .arg("-v") .env("__CARGO_DEFAULT_LIB_METADATA", "stable"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] bar v0.0.1 ({url}/bar) [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type dylib \ @@ -1520,18 +1502,17 @@ fn crate_env_vars() { .build(); println!("build"); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); println!("bin"); assert_that( process(&p.bin("foo")), execs() - .with_status(0) .with_stdout(&format!("0-5-1 @ alpha.1 in {}\n", p.root().display())), ); println!("test"); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } #[test] @@ -1572,18 +1553,17 @@ fn crate_authors_env_vars() { .build(); println!("build"); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); println!("bin"); assert_that( process(&p.bin("foo")), execs() - .with_status(0) .with_stdout("wycats@example.com:neikos@example.com"), ); println!("test"); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } // The tester may already have LD_LIBRARY_PATH=::/foo/bar which leads to a false positive error @@ -1619,7 +1599,7 @@ fn crate_library_path_env_var() { assert_that( setenv_for_removing_empty_component(p.cargo("run")), - execs().with_status(0), + execs(), ); } @@ -1634,7 +1614,7 @@ fn build_with_fake_libc_not_loading() { assert_that( setenv_for_removing_empty_component(p.cargo("build")), - execs().with_status(0), + execs(), ); } @@ -1661,7 +1641,7 @@ fn many_crate_types_old_style_lib_location() { .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] path `[..]src/foo.rs` was erroneously implicitly accepted for library `foo`, please rename the file to `src/lib.rs` or set lib.path in Cargo.toml", @@ -1693,7 +1673,7 @@ fn many_crate_types_correct() { ) .file("src/lib.rs", "pub fn foo() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file()); let fname = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX); @@ -1746,12 +1726,12 @@ fn ignore_broken_symlinks() { .symlink("Notafile", "bar") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("i am foo\n"), + execs().with_stdout("i am foo\n"), ); } @@ -1796,7 +1776,7 @@ fn lto_build() { .build(); assert_that( p.cargo("build").arg("-v").arg("--release"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] test v0.0.0 ({url}) [RUNNING] `rustc --crate-name test src/main.rs --crate-type bin \ @@ -1821,7 +1801,7 @@ fn verbose_build() { .build(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \ @@ -1844,7 +1824,7 @@ fn verbose_release_build() { .build(); assert_that( p.cargo("build").arg("-v").arg("--release"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \ @@ -1896,7 +1876,7 @@ fn verbose_release_build_deps() { .build(); assert_that( p.cargo("build").arg("-v").arg("--release"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ({url}/foo) [RUNNING] `rustc --crate-name foo foo/src/lib.rs \ @@ -1974,14 +1954,14 @@ fn explicit_examples() { ) .build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); assert_that( process(&p.bin("examples/hello")), - execs().with_status(0).with_stdout("Hello, World!\n"), + execs().with_stdout("Hello, World!\n"), ); assert_that( process(&p.bin("examples/goodbye")), - execs().with_status(0).with_stdout("Goodbye, World!\n"), + execs().with_stdout("Goodbye, World!\n"), ); } @@ -2060,7 +2040,7 @@ fn legacy_binary_paths_warnings() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] path `[..]src/main.rs` was erroneously implicitly accepted for binary `bar`, please set bin.path in Cargo.toml", @@ -2086,7 +2066,7 @@ please set bin.path in Cargo.toml", assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] path `[..]src/bin/main.rs` was erroneously implicitly accepted for binary `bar`, please set bin.path in Cargo.toml", @@ -2111,7 +2091,7 @@ please set bin.path in Cargo.toml", assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] path `[..]src/bar.rs` was erroneously implicitly accepted for binary `bar`, please set bin.path in Cargo.toml", @@ -2150,14 +2130,14 @@ fn implicit_examples() { ) .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); assert_that( process(&p.bin("examples/hello")), - execs().with_status(0).with_stdout("Hello, World!\n"), + execs().with_stdout("Hello, World!\n"), ); assert_that( process(&p.bin("examples/goodbye")), - execs().with_status(0).with_stdout("Goodbye, World!\n"), + execs().with_stdout("Goodbye, World!\n"), ); } @@ -2179,10 +2159,10 @@ fn standard_build_no_ndebug() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("slow\n"), + execs().with_stdout("slow\n"), ); } @@ -2204,10 +2184,10 @@ fn release_build_ndebug() { ) .build(); - assert_that(p.cargo("build").arg("--release"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--release"), execs()); assert_that( process(&p.release_bin("foo")), - execs().with_status(0).with_stdout("fast\n"), + execs().with_stdout("fast\n"), ); } @@ -2217,8 +2197,8 @@ fn inferred_main_bin() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(process(&p.bin("foo")), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); + assert_that(process(&p.bin("foo")), execs()); } #[test] @@ -2241,7 +2221,7 @@ fn deletion_causes_failure() { .file("bar/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); p.change_file("Cargo.toml", &basic_manifest("foo", "0.0.1")); assert_that(p.cargo("build"), execs().with_status(101)); } @@ -2253,8 +2233,8 @@ fn bad_cargo_toml_in_target_dir() { .file("target/Cargo.toml", "bad-toml") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(process(&p.bin("foo")), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); + assert_that(process(&p.bin("foo")), execs()); } #[test] @@ -2267,7 +2247,7 @@ fn lib_with_standard_name() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] syntax v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2299,7 +2279,7 @@ fn simple_staticlib() { // env var is a test for #1381 assert_that( p.cargo("build").env("RUST_LOG", "nekoneko=trace"), - execs().with_status(0), + execs(), ); } @@ -2323,7 +2303,7 @@ fn staticlib_rlib_and_bin() { .file("src/main.rs", "extern crate foo; fn main() { foo::foo(); }") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -2343,7 +2323,7 @@ fn opt_out_of_bin() { .file("src/lib.rs", "") .file("src/main.rs", "bad syntax") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -2364,7 +2344,7 @@ fn single_lib() { ) .file("src/bar.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -2388,7 +2368,7 @@ fn freshness_ignores_excluded() { assert_that( foo.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ({url}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2399,12 +2379,12 @@ fn freshness_ignores_excluded() { // Smoke test to make sure it doesn't compile again println!("first pass"); - assert_that(foo.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(foo.cargo("build"), execs().with_stdout("")); // Modify an ignored file and make sure we don't rebuild println!("second pass"); File::create(&foo.root().join("src/bar.rs")).unwrap(); - assert_that(foo.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(foo.cargo("build"), execs().with_stdout("")); } #[test] @@ -2443,7 +2423,7 @@ fn rebuild_preserves_out_dir() { assert_that( foo.cargo("build").env("FIRST", "1"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ({url}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2455,7 +2435,7 @@ fn rebuild_preserves_out_dir() { File::create(&foo.root().join("src/bar.rs")).unwrap(); assert_that( foo.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ({url}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2484,7 +2464,7 @@ fn dep_no_libs() { .file("bar/Cargo.toml", &basic_manifest("bar", "0.0.0")) .file("bar/src/main.rs", "") .build(); - assert_that(foo.cargo("build"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); } #[test] @@ -2505,9 +2485,9 @@ fn recompile_space_in_name() { ) .file("src/my lib.rs", "") .build(); - assert_that(foo.cargo("build"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); foo.root().move_into_the_past(); - assert_that(foo.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(foo.cargo("build"), execs().with_stdout("")); } #[cfg(unix)] @@ -2524,7 +2504,7 @@ fn ignore_bad_directories() { let mut perms = stat.permissions(); perms.set_mode(0o644); fs::set_permissions(&dir, perms.clone()).unwrap(); - assert_that(foo.cargo("build"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); perms.set_mode(0o755); fs::set_permissions(&dir, perms).unwrap(); } @@ -2590,10 +2570,10 @@ fn cargo_platform_specific_dependency() { .file("dev/src/lib.rs", "pub fn dev() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } #[test] @@ -2644,7 +2624,7 @@ fn cargo_platform_specific_dependency_wrong_platform() { p.cargo("build").exec_with_output().unwrap(); assert_that(&p.bin("foo"), existing_file()); - assert_that(process(&p.bin("foo")), execs().with_status(0)); + assert_that(process(&p.bin("foo")), execs()); let loc = p.root().join("Cargo.lock"); let mut lockfile = String::new(); @@ -2675,7 +2655,7 @@ fn example_as_lib() { .file("examples/ex.rs", "") .build(); - assert_that(p.cargo("build").arg("--example=ex"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--example=ex"), execs()); assert_that(&p.example_lib("ex", "lib"), existing_file()); } @@ -2699,7 +2679,7 @@ fn example_as_rlib() { .file("examples/ex.rs", "") .build(); - assert_that(p.cargo("build").arg("--example=ex"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--example=ex"), execs()); assert_that(&p.example_lib("ex", "rlib"), existing_file()); } @@ -2723,7 +2703,7 @@ fn example_as_dylib() { .file("examples/ex.rs", "") .build(); - assert_that(p.cargo("build").arg("--example=ex"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--example=ex"), execs()); assert_that(&p.example_lib("ex", "dylib"), existing_file()); } @@ -2751,7 +2731,7 @@ fn example_as_proc_macro() { .file("examples/ex.rs", "#![feature(proc_macro)]") .build(); - assert_that(p.cargo("build").arg("--example=ex"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--example=ex"), execs()); assert_that(&p.example_lib("ex", "proc-macro"), existing_file()); } @@ -2789,14 +2769,14 @@ fn compile_then_delete() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("run").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("run").arg("-v"), execs()); assert_that(&p.bin("foo"), existing_file()); if cfg!(windows) { // On windows unlinking immediately after running often fails, so sleep sleep_ms(100); } fs::remove_file(&p.bin("foo")).unwrap(); - assert_that(p.cargo("run").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("run").arg("-v"), execs()); } #[test] @@ -2901,7 +2881,7 @@ fn predictable_filenames() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file()); let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX); assert_that( @@ -2918,7 +2898,7 @@ fn dashes_to_underscores() { .file("src/main.rs", "extern crate foo_bar; fn main() {}") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); assert_that(&p.bin("foo-bar"), existing_file()); } @@ -2976,12 +2956,12 @@ fn filtering() { .file("examples/b.rs", "fn main() {}") .build(); - assert_that(p.cargo("build").arg("--lib"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--lib"), execs()); assert_that(&p.bin("a"), is_not(existing_file())); assert_that( p.cargo("build").arg("--bin=a").arg("--example=a"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("a"), existing_file()); assert_that(&p.bin("b"), is_not(existing_file())); @@ -2999,7 +2979,7 @@ fn filtering_implicit_bins() { .file("examples/b.rs", "fn main() {}") .build(); - assert_that(p.cargo("build").arg("--bins"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--bins"), execs()); assert_that(&p.bin("a"), existing_file()); assert_that(&p.bin("b"), existing_file()); assert_that(&p.bin("examples/a"), is_not(existing_file())); @@ -3016,7 +2996,7 @@ fn filtering_implicit_examples() { .file("examples/b.rs", "fn main() {}") .build(); - assert_that(p.cargo("build").arg("--examples"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--examples"), execs()); assert_that(&p.bin("a"), is_not(existing_file())); assert_that(&p.bin("b"), is_not(existing_file())); assert_that(&p.bin("examples/a"), existing_file()); @@ -3030,7 +3010,7 @@ fn ignore_dotfile() { .file("src/bin/a.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -3041,7 +3021,7 @@ fn ignore_dotdirs() { .file(".pc/dummy-fix.patch/Cargo.toml", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -3049,7 +3029,7 @@ fn dotdir_root() { let p = ProjectBuilder::new(root().join(".foo")) .file("src/bin/a.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -3062,7 +3042,7 @@ fn custom_target_dir_env() { assert_that( p.cargo("build").env("CARGO_TARGET_DIR", "foo/target"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("foo/target/debug").join(&exe_name), @@ -3073,7 +3053,7 @@ fn custom_target_dir_env() { is_not(existing_file()), ); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( &p.root().join("foo/target/debug").join(&exe_name), existing_file(), @@ -3095,7 +3075,7 @@ fn custom_target_dir_env() { .unwrap(); assert_that( p.cargo("build").env("CARGO_TARGET_DIR", "bar/target"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("bar/target/debug").join(&exe_name), @@ -3121,7 +3101,7 @@ fn custom_target_dir_line_parameter() { assert_that( p.cargo("build --target-dir foo/target"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("foo/target/debug").join(&exe_name), @@ -3132,7 +3112,7 @@ fn custom_target_dir_line_parameter() { is_not(existing_file()), ); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( &p.root().join("foo/target/debug").join(&exe_name), existing_file(), @@ -3154,7 +3134,7 @@ fn custom_target_dir_line_parameter() { .unwrap(); assert_that( p.cargo("build --target-dir bar/target"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("bar/target/debug").join(&exe_name), @@ -3172,7 +3152,7 @@ fn custom_target_dir_line_parameter() { assert_that( p.cargo("build --target-dir foobar/target") .env("CARGO_TARGET_DIR", "bar/target"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("foobar/target/debug").join(&exe_name), @@ -3232,12 +3212,12 @@ fn build_multiple_packages() { .file("d2/src/main.rs", "fn main() { println!(\"d2\"); }") .build(); - assert_that(p.cargo("build -p d1 -p d2 -p foo"), execs().with_status(0)); + assert_that(p.cargo("build -p d1 -p d2 -p foo"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("i am foo\n"), + execs().with_stdout("i am foo\n"), ); let d1_path = &p.build_dir() @@ -3248,10 +3228,10 @@ fn build_multiple_packages() { .join(format!("d2{}", env::consts::EXE_SUFFIX)); assert_that(d1_path, existing_file()); - assert_that(process(d1_path), execs().with_status(0).with_stdout("d1")); + assert_that(process(d1_path), execs().with_stdout("d1")); assert_that(d2_path, existing_file()); - assert_that(process(d2_path), execs().with_status(0).with_stdout("d2")); + assert_that(process(d2_path), execs().with_stdout("d2")); } #[test] @@ -3311,7 +3291,7 @@ fn manifest_with_bom_is_ok() { ) .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -3334,7 +3314,6 @@ fn panic_abort_compiles_with_panic_abort() { assert_that( p.cargo("build").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..] -C panic=abort [..]"), ); } @@ -3347,16 +3326,14 @@ fn explicit_color_config_is_propagated_to_rustc() { .build(); assert_that( p.cargo("build").arg("-v").arg("--color").arg("always"), - execs() - .with_status(0) - .with_stderr_contains("[..]rustc [..] src/lib.rs --color always[..]"), + execs().with_stderr_contains("[..]rustc [..] src/lib.rs --color always[..]"), ); - assert_that(p.cargo("clean"), execs().with_status(0)); + assert_that(p.cargo("clean"), execs()); assert_that( p.cargo("build").arg("-v").arg("--color").arg("never"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] test v0.0.0 ([..]) [RUNNING] `rustc [..] --color never [..]` @@ -3391,7 +3368,7 @@ fn compiler_json_error_format() { // Using jobs=1 to ensure that the order of messages is consistent. assert_that( p.cargo("build -v --message-format=json --jobs=1"), - execs().with_status(0).with_json( + execs().with_json( r#" { "reason":"compiler-artifact", @@ -3501,7 +3478,7 @@ fn compiler_json_error_format() { // but omit compiler warnings. assert_that( p.cargo("build -v --message-format=json --jobs=1"), - execs().with_status(0).with_json( + execs().with_json( r#" { "reason":"compiler-artifact", @@ -3614,7 +3591,7 @@ fn message_format_json_forward_stderr() { .arg("foo") .arg("--message-format") .arg("JSON"), - execs().with_status(0).with_json( + execs().with_json( r#" { "reason":"compiler-message", @@ -3679,7 +3656,7 @@ fn no_warn_about_package_metadata() { .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "[..] foo v0.0.1 ([..])\n\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n", ), @@ -3724,7 +3701,7 @@ fn build_all_workspace() { assert_that( p.cargo("build").arg("--all"), - execs().with_status(0).with_stderr( + execs().with_stderr( "[..] Compiling bar v0.1.0 ([..])\n\ [..] Compiling foo v0.1.0 ([..])\n\ [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n", @@ -3756,7 +3733,6 @@ fn build_all_exclude() { assert_that( p.cargo("build").arg("--all").arg("--exclude").arg("baz"), execs() - .with_status(0) .with_stderr_contains("[..]Compiling foo v0.1.0 [..]") .with_stderr_contains("[..]Compiling bar v0.1.0 [..]") .with_stderr_does_not_contain("[..]Compiling baz v0.1.0 [..]"), @@ -3794,7 +3770,7 @@ fn build_all_workspace_implicit_examples() { assert_that( p.cargo("build").arg("--all").arg("--examples"), - execs().with_status(0).with_stderr( + execs().with_stderr( "[..] Compiling bar v0.1.0 ([..])\n\ [..] Compiling foo v0.1.0 ([..])\n\ [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n", @@ -3830,7 +3806,6 @@ fn build_all_virtual_manifest() { assert_that( p.cargo("build").arg("--all"), execs() - .with_status(0) .with_stderr_contains("[..] Compiling baz v0.1.0 ([..])") .with_stderr_contains("[..] Compiling bar v0.1.0 ([..])") .with_stderr( @@ -3861,7 +3836,6 @@ fn build_virtual_manifest_all_implied() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr_contains("[..] Compiling baz v0.1.0 ([..])") .with_stderr_contains("[..] Compiling bar v0.1.0 ([..])") .with_stderr( @@ -3891,7 +3865,6 @@ fn build_virtual_manifest_one_project() { assert_that( p.cargo("build").arg("-p").arg("bar"), execs() - .with_status(0) .with_stderr_does_not_contain("[..]baz[..]") .with_stderr_contains("[..] Compiling bar v0.1.0 ([..])") .with_stderr( @@ -3929,7 +3902,6 @@ fn build_all_virtual_manifest_implicit_examples() { assert_that( p.cargo("build").arg("--all").arg("--examples"), execs() - .with_status(0) .with_stderr_contains("[..] Compiling baz v0.1.0 ([..])") .with_stderr_contains("[..] Compiling bar v0.1.0 ([..])") .with_stderr( @@ -3976,7 +3948,7 @@ fn build_all_member_dependency_same_name() { assert_that( p.cargo("build").arg("--all"), - execs().with_status(0).with_stderr( + execs().with_stderr( "[..] Updating registry `[..]`\n\ [..] Downloading a v0.1.0 ([..])\n\ [..] Compiling a v0.1.0\n\ @@ -4009,7 +3981,7 @@ fn run_proper_binary() { assert_that( p.cargo("run").arg("--bin").arg("other"), - execs().with_status(0), + execs(), ); } @@ -4023,7 +3995,7 @@ fn run_proper_binary_main_rs() { assert_that( p.cargo("run").arg("--bin").arg("foo"), - execs().with_status(0), + execs(), ); } @@ -4047,14 +4019,14 @@ fn run_proper_alias_binary_from_src() { .file("src/bar.rs", r#"fn main() { println!("bar"); }"#) .build(); - assert_that(p.cargo("build").arg("--all"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--all"), execs()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("foo\n"), + execs().with_stdout("foo\n"), ); assert_that( process(&p.bin("bar")), - execs().with_status(0).with_stdout("bar\n"), + execs().with_stdout("bar\n"), ); } @@ -4077,14 +4049,14 @@ fn run_proper_alias_binary_main_rs() { .file("src/main.rs", r#"fn main() { println!("main"); }"#) .build(); - assert_that(p.cargo("build").arg("--all"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--all"), execs()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("main\n"), + execs().with_stdout("main\n"), ); assert_that( process(&p.bin("bar")), - execs().with_status(0).with_stdout("main\n"), + execs().with_stdout("main\n"), ); } @@ -4098,7 +4070,7 @@ fn run_proper_binary_main_rs_as_foo() { assert_that( p.cargo("run").arg("--bin").arg("foo"), - execs().with_status(0), + execs(), ); } @@ -4118,9 +4090,7 @@ fn rustc_wrapper() { p.cargo("build") .arg("-v") .env("RUSTC_WRAPPER", "/usr/bin/env"), - execs() - .with_stderr_contains("[RUNNING] `/usr/bin/env rustc --crate-name foo [..]") - .with_status(0), + execs().with_stderr_contains("[RUNNING] `/usr/bin/env rustc --crate-name foo [..]"), ); } @@ -4142,7 +4112,7 @@ fn cdylib_not_lifted() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let files = if cfg!(windows) { vec!["foo.dll.lib", "foo.dll.exp", "foo.dll"] @@ -4179,7 +4149,7 @@ fn cdylib_final_outputs() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let files = if cfg!(windows) { vec!["foo_bar.dll.lib", "foo_bar.dll"] @@ -4234,7 +4204,7 @@ fn deterministic_cfg_flags() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.1.0 [..] [RUNNING] [..] @@ -4271,7 +4241,7 @@ fn explicit_bins_without_paths() { .file("src/bin/bar.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -4302,7 +4272,7 @@ fn inferred_bins() { .file("src/bin/baz/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); assert_that(&p.bin("baz"), existing_file()); @@ -4344,7 +4314,7 @@ fn inferred_bin_path() { .file("src/bin/bar/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("bar"), existing_file()); } @@ -4356,7 +4326,7 @@ fn inferred_examples() { .file("examples/baz/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); assert_that(&p.bin("examples/bar"), existing_file()); assert_that(&p.bin("examples/baz"), existing_file()); } @@ -4371,7 +4341,7 @@ fn inferred_tests() { assert_that( p.cargo("test").arg("--test=bar").arg("--test=baz"), - execs().with_status(0), + execs(), ); } @@ -4385,12 +4355,15 @@ fn inferred_benchmarks() { assert_that( p.cargo("bench").arg("--bench=bar").arg("--bench=baz"), - execs().with_status(0), + execs(), ); } #[test] fn target_edition() { + if !is_nightly() { // --edition is nightly-only + return; + } let p = project() .file( "Cargo.toml", @@ -4409,7 +4382,8 @@ fn target_edition() { assert_that( p.cargo("build").arg("-v").masquerade_as_nightly_cargo(), - execs().with_stderr_contains("\ + execs() + .with_stderr_contains("\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..]--edition=2018 [..] "), @@ -4505,7 +4479,6 @@ fn same_metadata_different_directory() { assert_that( p.cargo("build").arg("-v"), execs() - .with_status(0) .with_stderr_contains(format!("[..]{}[..]", metadata)), ); } @@ -4567,7 +4540,7 @@ fn uplift_dsym_of_bin_on_mac() { .arg("--bins") .arg("--examples") .arg("--tests"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo.dSYM"), existing_dir()); assert_that(&p.bin("b.dSYM"), existing_dir()); @@ -4599,7 +4572,7 @@ fn uplift_pdb_of_bin_on_windows() { .arg("--bins") .arg("--examples") .arg("--tests"), - execs().with_status(0), + execs(), ); assert_that(&p.target_debug_dir().join("foo.pdb"), existing_file()); assert_that(&p.target_debug_dir().join("b.pdb"), existing_file()); @@ -4622,7 +4595,6 @@ fn build_filter_infer_profile() { assert_that( p.cargo("build").arg("-v"), execs() - .with_status(0) .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \ @@ -4639,7 +4611,6 @@ fn build_filter_infer_profile() { assert_that( p.cargo("build").arg("-v").arg("--test=t1"), execs() - .with_status(0) .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \ @@ -4659,7 +4630,6 @@ fn build_filter_infer_profile() { assert_that( p.cargo("build").arg("-v").arg("--bench=b1"), execs() - .with_status(0) .with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \ @@ -4685,7 +4655,7 @@ fn targets_selected_default() { .build(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0) + execs() // bin .with_stderr_contains("\ [RUNNING] `rustc --crate-name foo src/main.rs --crate-type bin \ @@ -4708,7 +4678,7 @@ fn targets_selected_all() { .build(); assert_that( p.cargo("build").arg("-v").arg("--all-targets"), - execs().with_status(0) + execs() // bin .with_stderr_contains("\ [RUNNING] `rustc --crate-name foo src/main.rs --crate-type bin \ @@ -4731,7 +4701,7 @@ fn all_targets_no_lib() { .build(); assert_that( p.cargo("build").arg("-v").arg("--all-targets"), - execs().with_status(0) + execs() // bin .with_stderr_contains("\ [RUNNING] `rustc --crate-name foo src/main.rs --crate-type bin \ @@ -4778,7 +4748,7 @@ fn no_linkable_target() { .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] The package `the_lib` provides no linkable [..] \ while compiling `foo`. [..] in `the_lib`'s Cargo.toml. [..]", @@ -4810,7 +4780,7 @@ fn avoid_dev_deps() { p.cargo("build") .masquerade_as_nightly_cargo() .arg("-Zavoid-dev-deps"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/build_auth.rs b/tests/testsuite/build_auth.rs index 869b6d1289b..cd87d6e167b 100644 --- a/tests/testsuite/build_auth.rs +++ b/tests/testsuite/build_auth.rs @@ -84,7 +84,7 @@ fn http_auth_offered() { ) .build(); - assert_that(script.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(script.cargo("build").arg("-v"), execs()); let script = script.bin("script"); let config = paths::home().join(".gitconfig"); diff --git a/tests/testsuite/build_lib.rs b/tests/testsuite/build_lib.rs index 0b38d830011..f3aae097fc6 100644 --- a/tests/testsuite/build_lib.rs +++ b/tests/testsuite/build_lib.rs @@ -29,7 +29,6 @@ fn build_lib_only() { assert_that( p.cargo("build").arg("--lib").arg("-v"), execs() - .with_status(0) .with_stderr(verbose_output_for_lib(&p)), ); } @@ -73,6 +72,6 @@ fn build_with_relative_cargo_home_path() { assert_that( p.cargo("build").env("CARGO_HOME", "./cargo_home/"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/build_plan.rs b/tests/testsuite/build_plan.rs index afe474429be..1e4d63b6547 100644 --- a/tests/testsuite/build_plan.rs +++ b/tests/testsuite/build_plan.rs @@ -14,7 +14,7 @@ fn cargo_build_plan_simple() { .masquerade_as_nightly_cargo() .arg("--build-plan") .arg("-Zunstable-options"), - execs().with_status(0).with_json( + execs().with_json( r#" { "inputs": [ @@ -75,7 +75,7 @@ fn cargo_build_plan_single_dep() { .masquerade_as_nightly_cargo() .arg("--build-plan") .arg("-Zunstable-options"), - execs().with_status(0).with_json( + execs().with_json( r#" { "inputs": [ @@ -143,7 +143,7 @@ fn cargo_build_plan_build_script() { .masquerade_as_nightly_cargo() .arg("--build-plan") .arg("-Zunstable-options"), - execs().with_status(0).with_json( + execs().with_json( r#" { "inputs": [ diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index c4e57283b81..0d98e389379 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -131,7 +131,7 @@ fn custom_build_env_vars() { assert_that( p.cargo("build").arg("--features").arg("bar_feat"), - execs().with_status(0), + execs(), ); } @@ -168,7 +168,7 @@ fn custom_build_env_var_rustc_linker() { // only if build.rs succeeds, despite linker binary not existing. assert_that( p.cargo("build").arg("--target").arg(&target), - execs().with_status(0), + execs(), ); } @@ -453,7 +453,7 @@ fn overrides_and_links() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..] [..] @@ -498,7 +498,7 @@ fn unused_overrides() { ) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -555,7 +555,7 @@ fn links_passes_env_vars() { ) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -575,7 +575,7 @@ fn only_rerun_build_script() { .file("build.rs", "fn main() {}") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); p.root().move_into_the_past(); File::create(&p.root().join("some-new-file")).unwrap(); @@ -583,7 +583,7 @@ fn only_rerun_build_script() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 (file://[..]) [RUNNING] `[..]/build-script-build` @@ -653,13 +653,13 @@ fn rebuild_continues_to_pass_env_vars() { ) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); p.root().move_into_the_past(); File::create(&p.root().join("some-new-file")).unwrap(); p.root().move_into_the_past(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -680,7 +680,7 @@ fn testing_and_such() { .build(); println!("build"); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); p.root().move_into_the_past(); File::create(&p.root().join("src/lib.rs")).unwrap(); @@ -690,7 +690,6 @@ fn testing_and_such() { assert_that( p.cargo("test").arg("-vj1"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.5.0 (file://[..]) @@ -708,7 +707,7 @@ fn testing_and_such() { println!("doc"); assert_that( p.cargo("doc").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [DOCUMENTING] foo v0.5.0 (file://[..]) [RUNNING] `rustdoc [..]` @@ -724,7 +723,7 @@ fn testing_and_such() { println!("run"); assert_that( p.cargo("run"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 (file://[..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -793,7 +792,7 @@ fn propagation_of_l_flags() { assert_that( p.cargo("build").arg("-v").arg("-j1"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [RUNNING] `rustc --crate-name a [..] -L bar[..]-L foo[..]` [COMPILING] foo v0.5.0 (file://[..]) @@ -869,7 +868,7 @@ fn propagation_of_l_flags_new() { assert_that( p.cargo("build").arg("-v").arg("-j1"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [RUNNING] `rustc --crate-name a [..] -L bar[..]-L foo[..]` [COMPILING] foo v0.5.0 (file://[..]) @@ -909,7 +908,7 @@ fn build_deps_simple() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a v0.5.0 (file://[..]) [RUNNING] `rustc --crate-name a [..]` @@ -1020,7 +1019,7 @@ fn build_cmd_with_a_build_cmd() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] b v0.5.0 (file://[..]) [RUNNING] `rustc --crate-name b [..]` @@ -1079,7 +1078,7 @@ fn out_dir_is_preserved() { .build(); // Make the file - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); p.root().move_into_the_past(); // Change to asserting that it's there @@ -1097,14 +1096,14 @@ fn out_dir_is_preserved() { ) .unwrap(); p.root().move_into_the_past(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); // Run a fresh build where file should be preserved - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); // One last time to make sure it's still there. File::create(&p.root().join("foo")).unwrap(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -1231,7 +1230,6 @@ fn code_generation() { assert_that( p.cargo("run"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.5.0 (file://[..]) @@ -1241,7 +1239,7 @@ fn code_generation() { .with_stdout("Hello, World!"), ); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } #[test] @@ -1268,7 +1266,7 @@ fn release_with_build_script() { assert_that( p.cargo("build").arg("-v").arg("--release"), - execs().with_status(0), + execs(), ); } @@ -1347,7 +1345,7 @@ fn shared_dep_with_a_build_script() { ) .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -1399,7 +1397,7 @@ fn transitive_dep_host() { ) .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1445,7 +1443,7 @@ fn test_a_lib_with_a_build_command() { "#, ) .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } #[test] @@ -1478,7 +1476,7 @@ fn test_dev_dep_build_script() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } #[test] @@ -1568,7 +1566,7 @@ fn build_script_with_dynamic_native_dependency() { .cargo("build") .arg("-v") .env("RUST_LOG", "cargo::ops::cargo_rustc"), - execs().with_status(0), + execs(), ); assert_that( @@ -1576,7 +1574,7 @@ fn build_script_with_dynamic_native_dependency() { .arg("-v") .env("SRC", build.root()) .env("RUST_LOG", "cargo::ops::cargo_rustc"), - execs().with_status(0), + execs(), ); } @@ -1607,7 +1605,7 @@ fn profile_and_opt_level_set_correctly() { "#, ) .build(); - assert_that(p.cargo("bench"), execs().with_status(0)); + assert_that(p.cargo("bench"), execs()); } #[test] @@ -1638,7 +1636,7 @@ fn profile_debug_0() { "#, ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1660,7 +1658,7 @@ fn build_script_with_lto() { .file("src/lib.rs", "") .file("build.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1700,7 +1698,7 @@ fn test_duplicate_deps() { .file("bar/src/lib.rs", "pub fn do_nothing() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1719,7 +1717,7 @@ fn cfg_feedback() { .file("src/main.rs", "#[cfg(foo)] fn main() {}") .file("build.rs", r#"fn main() { println!("cargo:rustc-cfg=foo"); }"#) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -1752,7 +1750,7 @@ fn cfg_override() { ) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -1848,7 +1846,7 @@ fn cfg_doc() { .file("bar/build.rs", r#"fn main() { println!("cargo:rustc-cfg=bar"); }"#) .file("bar/src/lib.rs", "#[cfg(bar)] pub fn bar() {}") .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); assert_that(&p.root().join("target/doc"), existing_dir()); assert_that( &p.root().join("target/doc/foo/fn.foo.html"), @@ -1976,7 +1974,7 @@ fn cfg_override_doc() { .file("bar/build.rs", "") .file("bar/src/lib.rs", "#[cfg(bar)] pub fn bar() {}") .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); assert_that(&p.root().join("target/doc"), existing_dir()); assert_that( &p.root().join("target/doc/foo/fn.foo.html"), @@ -2012,10 +2010,10 @@ fn env_build() { ) .file("build.rs", r#"fn main() { println!("cargo:rustc-env=FOO=foo"); }"#) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); assert_that( p.cargo("run").arg("-v"), - execs().with_status(0).with_stdout("foo\n"), + execs().with_stdout("foo\n"), ); } @@ -2092,7 +2090,7 @@ fn env_doc() { .file("build.rs", r#"fn main() { println!("cargo:rustc-env=FOO=foo"); }"#, ) .build(); - assert_that(p.cargo("doc").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("doc").arg("-v"), execs()); } #[test] @@ -2148,7 +2146,6 @@ fn flags_go_into_tests() { assert_that( p.cargo("test").arg("-v").arg("--test=foo"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] a v0.5.0 ([..] @@ -2169,7 +2166,6 @@ fn flags_go_into_tests() { assert_that( p.cargo("test").arg("-v").arg("-pb").arg("--lib"), execs() - .with_status(0) .with_stderr( "\ [FRESH] a v0.5.0 ([..] @@ -2248,7 +2244,7 @@ fn diamond_passes_args_only_once() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] c v0.5.0 ([..] [RUNNING] `rustc [..]` @@ -2295,7 +2291,7 @@ fn adding_an_override_invalidates() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..] [RUNNING] `rustc [..]` @@ -2321,7 +2317,7 @@ fn adding_an_override_invalidates() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..] [RUNNING] `rustc [..] -L native=bar` @@ -2362,7 +2358,7 @@ fn changing_an_override_invalidates() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..] [RUNNING] `rustc [..] -L native=foo` @@ -2386,7 +2382,7 @@ fn changing_an_override_invalidates() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..] [RUNNING] `rustc [..] -L native=bar` @@ -2430,7 +2426,7 @@ fn fresh_builds_possible_with_link_libs() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..] [RUNNING] `rustc [..]` @@ -2443,7 +2439,7 @@ fn fresh_builds_possible_with_link_libs() { p.cargo("build") .arg("-v") .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] foo v0.5.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2488,7 +2484,7 @@ fn fresh_builds_possible_with_multiple_metadata_overrides() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..] [RUNNING] `rustc [..]` @@ -2501,7 +2497,7 @@ fn fresh_builds_possible_with_multiple_metadata_overrides() { p.cargo("build") .arg("-v") .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] foo v0.5.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2535,13 +2531,13 @@ fn rebuild_only_on_explicit_paths() { ) .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); // files don't exist, so should always rerun if they don't exist println!("run without"); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..]) [RUNNING] `[..]/build-script-build` @@ -2559,7 +2555,7 @@ fn rebuild_only_on_explicit_paths() { println!("run with"); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..]) [RUNNING] `[..]/build-script-build` @@ -2572,7 +2568,7 @@ fn rebuild_only_on_explicit_paths() { println!("run with2"); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] foo v0.5.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2587,7 +2583,7 @@ fn rebuild_only_on_explicit_paths() { File::create(p.root().join("baz")).unwrap(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] foo v0.5.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -2600,7 +2596,7 @@ fn rebuild_only_on_explicit_paths() { File::create(p.root().join("foo")).unwrap(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..]) [RUNNING] `[..]/build-script-build` @@ -2615,7 +2611,7 @@ fn rebuild_only_on_explicit_paths() { fs::remove_file(p.root().join("bar")).unwrap(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..]) [RUNNING] `[..]/build-script-build` @@ -2665,7 +2661,7 @@ fn doctest_receives_build_link_args() { assert_that( p.cargo("test").arg("-v"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`", ), ); @@ -2721,7 +2717,6 @@ fn please_respect_the_dag() { assert_that( p.cargo("build").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustc [..] -L native=foo -L native=bar[..]`"), ); } @@ -2760,7 +2755,7 @@ fn non_utf8_output() { .file("src/main.rs", "#[cfg(foo)] fn main() {}") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -2800,7 +2795,7 @@ fn custom_target_dir() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -2858,14 +2853,14 @@ fn panic_abort_with_build_scripts() { assert_that( p.cargo("build").arg("-v").arg("--release"), - execs().with_status(0), + execs(), ); p.root().join("target").rm_rf(); assert_that( p.cargo("test --release -v"), - execs().with_status(0).with_stderr_does_not_contain("[..]panic[..]"), + execs().with_stderr_does_not_contain("[..]panic[..]"), ); } @@ -2896,7 +2891,7 @@ fn warnings_emitted() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.5.0 ([..]) [RUNNING] `rustc [..]` @@ -2953,7 +2948,7 @@ fn warnings_hidden_for_upstream() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.1.0 ([..]) @@ -3012,7 +3007,7 @@ fn warnings_printed_on_vv() { assert_that( p.cargo("build").arg("-vv"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.1.0 ([..]) @@ -3059,7 +3054,7 @@ fn output_shows_on_vv() { assert_that( p.cargo("build").arg("-vv"), - execs().with_status(0).with_stdout("stdout").with_stderr( + execs().with_stdout("stdout").with_stderr( "\ [COMPILING] foo v0.5.0 ([..]) [RUNNING] `rustc [..]` @@ -3112,7 +3107,6 @@ fn links_with_dots() { assert_that( p.cargo("build").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustc --crate-name foo [..] [..] -L foo[..]`"), ); } @@ -3143,7 +3137,7 @@ fn rustc_and_rustdoc_set_correctly() { "#, ) .build(); - assert_that(p.cargo("bench"), execs().with_status(0)); + assert_that(p.cargo("bench"), execs()); } #[test] @@ -3176,7 +3170,7 @@ fn cfg_env_vars_available() { "#, ) .build(); - assert_that(p.cargo("bench"), execs().with_status(0)); + assert_that(p.cargo("bench"), execs()); } #[test] @@ -3228,15 +3222,15 @@ fn switch_features_rerun() { assert_that( p.cargo("run").arg("-v").arg("--features=foo"), - execs().with_status(0).with_stdout("foo\n"), + execs().with_stdout("foo\n"), ); assert_that( p.cargo("run").arg("-v"), - execs().with_status(0).with_stdout("bar\n"), + execs().with_stdout("bar\n"), ); assert_that( p.cargo("run").arg("-v").arg("--features=foo"), - execs().with_status(0).with_stdout("foo\n"), + execs().with_stdout("foo\n"), ); } @@ -3263,7 +3257,7 @@ fn assume_build_script_when_build_rs_present() { ) .build(); - assert_that(p.cargo("run").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("run").arg("-v"), execs()); } #[test] @@ -3299,7 +3293,7 @@ fn if_build_set_to_false_dont_treat_build_rs_as_build_script() { ) .build(); - assert_that(p.cargo("run").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("run").arg("-v"), execs()); } #[test] @@ -3413,7 +3407,7 @@ fn deterministic_rustc_dependency_flags() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [RUNNING] `rustc --crate-name foo [..] -L native=test1 -L native=test2 \ -L native=test3 -L native=test4` @@ -3505,7 +3499,7 @@ fn rename_with_link_search_path() { .file("src/lib.rs", "#[no_mangle] pub extern fn cargo_test_foo() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let p2 = project().at("bar") .file("Cargo.toml", &basic_manifest("bar", "0.5.0")) @@ -3578,7 +3572,7 @@ fn rename_with_link_search_path() { .unwrap(); // Everything should work the first time - assert_that(p2.cargo("run"), execs().with_status(0)); + assert_that(p2.cargo("run"), execs()); // Now rename the root directory and rerun `cargo run`. Not only should we // not build anything but we also shouldn't crash. @@ -3609,7 +3603,7 @@ fn rename_with_link_search_path() { assert_that( p2.cargo("run").cwd(&new), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FINISHED] [..] [RUNNING] [..] @@ -3663,10 +3657,10 @@ fn optional_build_script_dep() { .file("bar/src/lib.rs", "pub fn bar() -> u32 { 1 }"); let p = p.build(); - assert_that(p.cargo("run"), execs().with_status(0).with_stdout("0\n")); + assert_that(p.cargo("run"), execs().with_stdout("0\n")); assert_that( p.cargo("run --features bar"), - execs().with_status(0).with_stdout("1\n"), + execs().with_stdout("1\n"), ); } @@ -3712,7 +3706,7 @@ fn optional_build_dep_and_required_normal_dep() { assert_that( p.cargo("run"), - execs().with_status(0).with_stdout("0").with_stderr( + execs().with_stdout("0").with_stderr( "\ [COMPILING] bar v0.5.0 ([..]) [COMPILING] foo v0.1.0 ([..]) @@ -3723,7 +3717,7 @@ fn optional_build_dep_and_required_normal_dep() { assert_that( p.cargo("run --all-features"), - execs().with_status(0).with_stdout("1").with_stderr( + execs().with_stdout("1").with_stderr( "\ [COMPILING] foo v0.1.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] diff --git a/tests/testsuite/build_script_env.rs b/tests/testsuite/build_script_env.rs index 2aa9d549086..5006441e9c1 100644 --- a/tests/testsuite/build_script_env.rs +++ b/tests/testsuite/build_script_env.rs @@ -20,7 +20,7 @@ fn rerun_if_env_changes() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] [..] @@ -29,7 +29,7 @@ fn rerun_if_env_changes() { ); assert_that( p.cargo("build").env("FOO", "bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] [..] @@ -38,7 +38,7 @@ fn rerun_if_env_changes() { ); assert_that( p.cargo("build").env("FOO", "baz"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] [..] @@ -47,11 +47,11 @@ fn rerun_if_env_changes() { ); assert_that( p.cargo("build").env("FOO", "baz"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] [..] @@ -78,7 +78,7 @@ fn rerun_if_env_or_file_changes() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] [..] @@ -87,7 +87,7 @@ fn rerun_if_env_or_file_changes() { ); assert_that( p.cargo("build").env("FOO", "bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] [..] @@ -96,13 +96,13 @@ fn rerun_if_env_or_file_changes() { ); assert_that( p.cargo("build").env("FOO", "bar"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); sleep_ms(1000); File::create(p.root().join("foo")).unwrap(); assert_that( p.cargo("build").env("FOO", "bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] [..] diff --git a/tests/testsuite/cargo_alias_config.rs b/tests/testsuite/cargo_alias_config.rs index 5e136467869..f33391d6253 100644 --- a/tests/testsuite/cargo_alias_config.rs +++ b/tests/testsuite/cargo_alias_config.rs @@ -42,7 +42,6 @@ fn alias_default_config_overrides_config() { assert_that( p.cargo("b").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[COMPILING] foo v0.5.0 [..]"), ); } @@ -64,7 +63,6 @@ fn alias_config() { assert_that( p.cargo("b-cargo-test -v"), execs() - .with_status(0) .with_stderr_contains( "\ [COMPILING] foo v0.5.0 [..] @@ -90,7 +88,7 @@ fn recursive_alias() { assert_that( p.cargo("a-cargo-test"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [COMPILING] foo v0.5.0 [..] [RUNNING] `rustc --crate-name foo [..]", @@ -115,7 +113,6 @@ fn alias_list_test() { assert_that( p.cargo("b-cargo-test").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[COMPILING] foo v0.5.0 [..]") .with_stderr_contains("[RUNNING] `rustc --crate-name [..]"), ); @@ -138,7 +135,6 @@ fn alias_with_flags_config() { assert_that( p.cargo("b-cargo-test").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[COMPILING] foo v0.5.0 [..]") .with_stderr_contains("[RUNNING] `rustc --crate-name foo [..]"), ); @@ -160,7 +156,7 @@ fn cant_shadow_builtin() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [WARNING] alias `build` is ignored, because it is shadowed by a built in command [COMPILING] foo v0.5.0 ([..]) diff --git a/tests/testsuite/cargo_command.rs b/tests/testsuite/cargo_command.rs index 9ed4f7a1ed0..dde4a66d51d 100644 --- a/tests/testsuite/cargo_command.rs +++ b/tests/testsuite/cargo_command.rs @@ -158,18 +158,16 @@ error: no such subcommand: `biuld` assert_that( cargo_process("install cargo-biuld"), - execs().with_status(0), + execs(), ); assert_that( cargo_process("biuld"), execs() - .with_status(0) .with_stdout("Similar, but not identical to, build\n"), ); assert_that( cargo_process("--list"), execs() - .with_status(0) .with_stdout_contains(" build Compile a local package and all of its dependencies\n") .with_stdout_contains(" biuld\n"), ); @@ -218,7 +216,7 @@ fn override_cargo_home() { assert_that( cargo_process("new foo").env("USER", "foo").env("CARGO_HOME", &my_home), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -250,7 +248,7 @@ fn cargo_subcommand_env() { let target_dir = p.target_debug_dir(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("cargo-envtest"), existing_file()); let cargo = cargo_exe().canonicalize().unwrap(); @@ -260,7 +258,7 @@ fn cargo_subcommand_env() { assert_that( cargo_process("envtest").env("PATH", &path), - execs().with_status(0).with_stdout(cargo.to_str().unwrap()), + execs().with_stdout(cargo.to_str().unwrap()), ); } @@ -279,7 +277,7 @@ fn cargo_subcommand_args() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let cargo_foo_bin = p.bin("cargo-foo"); assert_that(&cargo_foo_bin, existing_file()); @@ -289,7 +287,7 @@ fn cargo_subcommand_args() { assert_that( cargo_process("foo bar -v --help").env("PATH", &path), - execs().with_status(0).with_stdout(format!( + execs().with_stdout(format!( r#"[{:?}, "foo", "bar", "-v", "--help"]"#, cargo_foo_bin )), @@ -298,12 +296,12 @@ fn cargo_subcommand_args() { #[test] fn cargo_help() { - assert_that(cargo_process(""), execs().with_status(0)); - assert_that(cargo_process("help"), execs().with_status(0)); - assert_that(cargo_process("-h"), execs().with_status(0)); - assert_that(cargo_process("help build"), execs().with_status(0)); - assert_that(cargo_process("build -h"), execs().with_status(0)); - assert_that(cargo_process("help help"), execs().with_status(0)); + assert_that(cargo_process(""), execs()); + assert_that(cargo_process("help"), execs()); + assert_that(cargo_process("-h"), execs()); + assert_that(cargo_process("help build"), execs()); + assert_that(cargo_process("build -h"), execs()); + assert_that(cargo_process("help help"), execs()); } #[test] @@ -321,11 +319,11 @@ fn cargo_help_external_subcommand() { .publish(); assert_that( cargo_process("install cargo-fake-help"), - execs().with_status(0), + execs(), ); assert_that( cargo_process("help fake-help"), - execs().with_status(0).with_stdout("fancy help output\n") + execs().with_stdout("fancy help output\n") ); } @@ -333,7 +331,7 @@ fn cargo_help_external_subcommand() { fn explain() { assert_that( cargo_process("--explain E0001"), - execs().with_status(0).with_stdout_contains( + execs().with_stdout_contains( "This error suggests that the expression arm corresponding to the noted pattern", ), ); @@ -345,7 +343,7 @@ fn explain() { fn z_flags_help() { assert_that( cargo_process("-Z help"), - execs().with_status(0).with_stdout_contains( + execs().with_stdout_contains( " -Z unstable-options -- Allow the usage of unstable options such as --registry", ), ); diff --git a/tests/testsuite/cargo_features.rs b/tests/testsuite/cargo_features.rs index f79354eb60f..d8a5ff1c87b 100644 --- a/tests/testsuite/cargo_features.rs +++ b/tests/testsuite/cargo_features.rs @@ -101,7 +101,7 @@ fn stable_feature_warns() { .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: the cargo feature `test-dummy-stable` is now stable and is no longer \ necessary to be listed in the manifest @@ -131,7 +131,7 @@ fn nightly_feature_requires_nightly() { .build(); assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a [..] [FINISHED] [..] @@ -185,7 +185,7 @@ fn nightly_feature_requires_nightly_in_dep() { .build(); assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a [..] [COMPILING] b [..] @@ -233,7 +233,7 @@ fn cant_publish() { .build(); assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a [..] [FINISHED] [..] @@ -291,7 +291,6 @@ fn z_flags_rejected() { .masquerade_as_nightly_cargo() .arg("-Zprint-im-a-teapot"), execs() - .with_status(0) .with_stdout("im-a-teapot = true\n") .with_stderr( "\ @@ -325,6 +324,6 @@ fn publish_allowed() { .arg("--index") .arg(publish::registry().to_string()) .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/cfg.rs b/tests/testsuite/cfg.rs index 7c490884fb3..2c733a54ff1 100644 --- a/tests/testsuite/cfg.rs +++ b/tests/testsuite/cfg.rs @@ -162,7 +162,7 @@ fn cfg_easy() { .file("b/Cargo.toml", &basic_manifest("b", "0.0.1")) .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -190,7 +190,7 @@ fn dont_include() { .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -225,7 +225,7 @@ fn works_through_the_registry() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry [..] [DOWNLOADING] [..] @@ -270,7 +270,7 @@ fn ignore_version_from_other_platform() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry [..] [DOWNLOADING] [..] @@ -383,7 +383,7 @@ fn multiple_match_ok() { .file("b/Cargo.toml", &basic_manifest("b", "0.0.1")) .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -405,7 +405,7 @@ fn any_ok() { .file("b/Cargo.toml", &basic_manifest("b", "0.0.1")) .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } // https://github.com/rust-lang/cargo/issues/5313 @@ -441,6 +441,6 @@ fn cfg_looks_at_rustflags_for_target() { assert_that( p.cargo("build --target x86_64-unknown-linux-gnu") .env("RUSTFLAGS", "--cfg with_b"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs index 86ddd789449..c2bb8eefa6a 100644 --- a/tests/testsuite/check.rs +++ b/tests/testsuite/check.rs @@ -28,7 +28,7 @@ fn check_success() { .file("src/lib.rs", "pub fn baz() {}") .build(); - assert_that(foo.cargo("check"), execs().with_status(0)); + assert_that(foo.cargo("check"), execs()); } #[test] @@ -118,7 +118,7 @@ pub fn derive(_input: TokenStream) -> TokenStream { ) .build(); - assert_that(foo.cargo("check"), execs().with_status(0)); + assert_that(foo.cargo("check"), execs()); } #[test] @@ -144,8 +144,8 @@ fn check_build() { .file("src/lib.rs", "pub fn baz() {}") .build(); - assert_that(foo.cargo("check"), execs().with_status(0)); - assert_that(foo.cargo("build"), execs().with_status(0)); + assert_that(foo.cargo("check"), execs()); + assert_that(foo.cargo("build"), execs()); } #[test] @@ -171,8 +171,8 @@ fn build_check() { .file("src/lib.rs", "pub fn baz() {}") .build(); - assert_that(foo.cargo("build"), execs().with_status(0)); - assert_that(foo.cargo("check"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); + assert_that(foo.cargo("check"), execs()); } // Checks that where a project has both a lib and a bin, the lib is only checked @@ -187,7 +187,6 @@ fn issue_3418() { assert_that( foo.cargo("check").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..] --emit=dep-info,metadata [..]"), ); } @@ -251,7 +250,7 @@ fn issue_3419() { ) .publish(); - assert_that(p.cargo("check"), execs().with_status(0)); + assert_that(p.cargo("check"), execs()); } // Check on a dylib should have a different metadata hash than build. @@ -277,7 +276,7 @@ fn dylib_check_preserves_build_cache() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..]Compiling foo v0.1.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -285,12 +284,11 @@ fn dylib_check_preserves_build_cache() { ), ); - assert_that(p.cargo("check"), execs().with_status(0)); + assert_that(p.cargo("check"), execs()); assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); } @@ -324,7 +322,7 @@ fn rustc_check() { .arg("check") .arg("--") .arg("--emit=metadata"), - execs().with_status(0), + execs(), ); } @@ -388,7 +386,6 @@ fn check_all() { assert_that( p.cargo("check").arg("--all").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..] --crate-name foo src/lib.rs [..]") .with_stderr_contains("[..] --crate-name foo src/main.rs [..]") .with_stderr_contains("[..] --crate-name b b/src/lib.rs [..]") @@ -415,7 +412,6 @@ fn check_virtual_all_implied() { assert_that( p.cargo("check").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..] --crate-name bar bar/src/lib.rs [..]") .with_stderr_contains("[..] --crate-name baz baz/src/lib.rs [..]"), ); @@ -434,7 +430,6 @@ fn targets_selected_default() { assert_that( foo.cargo("check").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..] --crate-name foo src/lib.rs [..]") .with_stderr_contains("[..] --crate-name foo src/main.rs [..]") .with_stderr_does_not_contain("[..] --crate-name example1 examples/example1.rs [..]") @@ -456,7 +451,6 @@ fn targets_selected_all() { assert_that( foo.cargo("check").arg("--all-targets").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..] --crate-name foo src/lib.rs [..]") .with_stderr_contains("[..] --crate-name foo src/main.rs [..]") .with_stderr_contains("[..] --crate-name example1 examples/example1.rs [..]") @@ -482,7 +476,7 @@ fn check_unit_test_profile() { ) .build(); - assert_that(foo.cargo("check"), execs().with_status(0)); + assert_that(foo.cargo("check"), execs()); assert_that( foo.cargo("check").arg("--profile").arg("test"), execs() @@ -552,7 +546,6 @@ fn check_filters() { assert_that( p.cargo("check"), execs() - .with_status(0) .with_stderr_contains("[..]unused_normal_lib[..]") .with_stderr_contains("[..]unused_normal_bin[..]") .with_stderr_does_not_contain("[..]unused_normal_t1[..]") @@ -564,7 +557,6 @@ fn check_filters() { assert_that( p.cargo("check").arg("--tests").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..] --crate-name foo src/lib.rs [..] --test [..]") .with_stderr_contains("[..] --crate-name foo src/lib.rs --crate-type lib [..]") .with_stderr_contains("[..] --crate-name foo src/main.rs [..] --test [..]") @@ -583,7 +575,6 @@ fn check_filters() { assert_that( p.cargo("check").arg("--test").arg("t1").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..]unused_normal_lib[..]") .with_stderr_contains("[..]unused_unit_t1[..]") .with_stderr_does_not_contain("[..]unused_unit_lib[..]") @@ -598,7 +589,6 @@ fn check_filters() { assert_that( p.cargo("check").arg("--all-targets").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[..]unused_normal_lib[..]") .with_stderr_contains("[..]unused_normal_bin[..]") .with_stderr_contains("[..]unused_normal_t1[..]") @@ -622,7 +612,7 @@ fn check_artifacts() { .file("examples/ex1.rs", "fn main() {}") .file("benches/b1.rs", "") .build(); - assert_that(p.cargo("check"), execs().with_status(0)); + assert_that(p.cargo("check"), execs()); assert_that(&p.root().join("target/debug/libfoo.rmeta"), existing_file()); assert_that( &p.root().join("target/debug/libfoo.rlib"), @@ -634,7 +624,7 @@ fn check_artifacts() { ); p.root().join("target").rm_rf(); - assert_that(p.cargo("check").arg("--lib"), execs().with_status(0)); + assert_that(p.cargo("check").arg("--lib"), execs()); assert_that(&p.root().join("target/debug/libfoo.rmeta"), existing_file()); assert_that( &p.root().join("target/debug/libfoo.rlib"), @@ -648,7 +638,7 @@ fn check_artifacts() { p.root().join("target").rm_rf(); assert_that( p.cargo("check").arg("--bin").arg("foo"), - execs().with_status(0), + execs(), ); if is_nightly() { // The nightly check can be removed once 1.27 is stable. @@ -668,7 +658,7 @@ fn check_artifacts() { p.root().join("target").rm_rf(); assert_that( p.cargo("check").arg("--test").arg("t1"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("target/debug/libfoo.rmeta"), @@ -692,7 +682,7 @@ fn check_artifacts() { p.root().join("target").rm_rf(); assert_that( p.cargo("check").arg("--example").arg("ex1"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("target/debug/libfoo.rmeta"), @@ -710,7 +700,7 @@ fn check_artifacts() { p.root().join("target").rm_rf(); assert_that( p.cargo("check").arg("--bench").arg("b1"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join("target/debug/libfoo.rmeta"), @@ -774,6 +764,6 @@ fn proc_macro() { .build(); assert_that( p.cargo("check").arg("-v").env("RUST_LOG", "cargo=trace"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/clean.rs b/tests/testsuite/clean.rs index cddd3365a29..16fe882f8a5 100644 --- a/tests/testsuite/clean.rs +++ b/tests/testsuite/clean.rs @@ -11,10 +11,10 @@ fn cargo_clean_simple() { .file("src/foo.rs", &main_file(r#""i am foo""#, &[])) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.build_dir(), existing_dir()); - assert_that(p.cargo("clean"), execs().with_status(0)); + assert_that(p.cargo("clean"), execs()); assert_that(&p.build_dir(), is_not(existing_dir())); } @@ -26,12 +26,12 @@ fn different_dir() { .file("src/bar/a.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.build_dir(), existing_dir()); assert_that( p.cargo("clean").cwd(&p.root().join("src")), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); assert_that(&p.build_dir(), is_not(existing_dir())); } @@ -63,7 +63,7 @@ fn clean_multiple_packages() { .file("d2/src/main.rs", "fn main() { println!(\"d2\"); }") .build(); - assert_that(p.cargo("build -p d1 -p d2 -p foo"), execs().with_status(0)); + assert_that(p.cargo("build -p d1 -p d2 -p foo"), execs()); let d1_path = &p.build_dir() .join("debug") @@ -78,7 +78,7 @@ fn clean_multiple_packages() { assert_that( p.cargo("clean -p d1 -p d2").cwd(&p.root().join("src")), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); assert_that(&p.bin("foo"), existing_file()); assert_that(d1_path, is_not(existing_file())); @@ -105,24 +105,24 @@ fn clean_release() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("--release"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--release"), execs()); assert_that( p.cargo("clean").arg("-p").arg("foo"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").arg("--release"), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); assert_that( p.cargo("clean").arg("-p").arg("foo").arg("--release"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").arg("--release"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] release [optimized] target(s) in [..] @@ -151,13 +151,13 @@ fn clean_doc() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); let doc_path = &p.build_dir().join("doc"); assert_that(doc_path, existing_dir()); - assert_that(p.cargo("clean").arg("--doc"), execs().with_status(0)); + assert_that(p.cargo("clean").arg("--doc"), execs()); assert_that(doc_path, is_not(existing_dir())); assert_that(p.build_dir(), existing_dir()); @@ -196,14 +196,14 @@ fn build_script() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build").env("FIRST", "1"), execs().with_status(0)); + assert_that(p.cargo("build").env("FIRST", "1"), execs()); assert_that( p.cargo("clean").arg("-p").arg("foo"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] build.rs [..]` @@ -242,12 +242,12 @@ fn clean_git() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("clean").arg("-p").arg("dep"), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -270,12 +270,12 @@ fn registry() { Package::new("bar", "0.1.0").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("clean").arg("-p").arg("bar"), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -297,15 +297,15 @@ fn clean_verbose() { Package::new("bar", "0.1.0").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("clean").arg("-p").arg("bar").arg("--verbose"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [REMOVING] [..] [REMOVING] [..] ", ), ); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } diff --git a/tests/testsuite/concurrent.rs b/tests/testsuite/concurrent.rs index fc2ea285d43..7c6bbeafdd1 100644 --- a/tests/testsuite/concurrent.rs +++ b/tests/testsuite/concurrent.rs @@ -43,8 +43,8 @@ fn multiple_installs() { let b = b.wait_with_output().unwrap(); let a = a.join().unwrap(); - assert_that(a, execs().with_status(0)); - assert_that(b, execs().with_status(0)); + assert_that(a, execs()); + assert_that(b, execs()); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_home(), has_installed_exe("bar")); @@ -72,8 +72,8 @@ fn concurrent_installs() { assert!(!str::from_utf8(&a.stderr).unwrap().contains(LOCKED_BUILD)); assert!(!str::from_utf8(&b.stderr).unwrap().contains(LOCKED_BUILD)); - assert_that(a, execs().with_status(0)); - assert_that(b, execs().with_status(0)); + assert_that(a, execs()); + assert_that(b, execs()); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_home(), has_installed_exe("bar")); @@ -115,7 +115,6 @@ fn one_install_should_be_bad() { assert_that( good, execs() - .with_status(0) .with_stderr_contains("warning: be sure to add `[..]` to your PATH [..]"), ); @@ -174,8 +173,8 @@ fn multiple_registry_fetches() { let b = b.wait_with_output().unwrap(); let a = a.join().unwrap(); - assert_that(a, execs().with_status(0)); - assert_that(b, execs().with_status(0)); + assert_that(a, execs()); + assert_that(b, execs()); let suffix = env::consts::EXE_SUFFIX; assert_that( @@ -265,8 +264,8 @@ fn git_same_repo_different_tags() { let b = b.wait_with_output().unwrap(); let a = a.join().unwrap(); - assert_that(a, execs().with_status(0)); - assert_that(b, execs().with_status(0)); + assert_that(a, execs()); + assert_that(b, execs()); } #[test] @@ -317,7 +316,7 @@ fn git_same_branch_different_revs() { // target directory assert_that( p.cargo("build").cwd(p.root().join("a")), - execs().with_status(0), + execs(), ); fs::remove_dir_all(p.root().join("a/target")).unwrap(); @@ -344,8 +343,8 @@ fn git_same_branch_different_revs() { let b = b.wait_with_output().unwrap(); let a = a.join().unwrap(); - assert_that(a, execs().with_status(0)); - assert_that(b, execs().with_status(0)); + assert_that(a, execs()); + assert_that(b, execs()); } #[test] @@ -367,8 +366,8 @@ fn same_project() { let b = b.wait_with_output().unwrap(); let a = a.join().unwrap(); - assert_that(a, execs().with_status(0)); - assert_that(b, execs().with_status(0)); + assert_that(a, execs()); + assert_that(b, execs()); } // Make sure that if Cargo dies while holding a lock that it's released and the @@ -433,7 +432,7 @@ fn killing_cargo_releases_the_lock() { // We killed `a`, so it shouldn't succeed, but `b` should have succeeded. assert!(!a.status.success()); - assert_that(b, execs().with_status(0)); + assert_that(b, execs()); } #[test] @@ -442,7 +441,7 @@ fn debug_release_ok() { .file("src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); fs::remove_dir_all(p.root().join("target")).unwrap(); let mut a = p.cargo("build").build_command(); @@ -457,7 +456,7 @@ fn debug_release_ok() { assert_that( a, - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 [..] [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -466,7 +465,7 @@ fn debug_release_ok() { ); assert_that( b, - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 [..] [FINISHED] release [optimized] target(s) in [..] @@ -528,6 +527,6 @@ fn no_deadlock_with_git_dependencies() { for _ in 0..n_concurrent_builds { let result = rx.recv_timeout(Duration::from_secs(30)).expect("Deadlock!"); - assert_that(result, execs().with_status(0)) + assert_that(result, execs()) } } diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 5c620f6c175..fc7d02d1f53 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -34,7 +34,7 @@ fn read_env_vars_for_config() { assert_that( p.cargo("build").env("CARGO_BUILD_JOBS", "100"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/corrupt_git.rs b/tests/testsuite/corrupt_git.rs index 105b0ad42a2..dc219045230 100644 --- a/tests/testsuite/corrupt_git.rs +++ b/tests/testsuite/corrupt_git.rs @@ -34,7 +34,7 @@ fn deleting_database_files() { .file("src/lib.rs", "") .build(); - assert_that(project.cargo("build"), execs().with_status(0)); + assert_that(project.cargo("build"), execs()); let mut files = Vec::new(); find_files(&paths::home().join(".cargo/git/db"), &mut files); @@ -49,7 +49,7 @@ fn deleting_database_files() { cargopaths::remove_file(&file).unwrap(); assert_that( project.cargo("build").env("RUST_LOG", log).arg("-v"), - execs().with_status(0), + execs(), ); if !file.exists() { @@ -65,7 +65,7 @@ fn deleting_database_files() { .unwrap(); assert_that( project.cargo("build").env("RUST_LOG", log).arg("-v"), - execs().with_status(0), + execs(), ); } } @@ -98,7 +98,7 @@ fn deleting_checkout_files() { .file("src/lib.rs", "") .build(); - assert_that(project.cargo("build"), execs().with_status(0)); + assert_that(project.cargo("build"), execs()); let dir = paths::home() .join(".cargo/git/checkouts") @@ -131,7 +131,7 @@ fn deleting_checkout_files() { cargopaths::remove_file(&file).unwrap(); assert_that( project.cargo("build").env("RUST_LOG", log).arg("-v"), - execs().with_status(0), + execs(), ); if !file.exists() { @@ -147,7 +147,7 @@ fn deleting_checkout_files() { .unwrap(); assert_that( project.cargo("build").env("RUST_LOG", log).arg("-v"), - execs().with_status(0), + execs(), ); } } diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index 828fac65729..630c7651f49 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -48,13 +48,13 @@ fn simple_cross() { let target = cross_compile::alternate(); assert_that( p.cargo("build").arg("--target").arg(&target).arg("-v"), - execs().with_status(0), + execs(), ); assert_that(&p.target_bin(&target, "foo"), existing_file()); assert_that( process(&p.target_bin(&target, "foo")), - execs().with_status(0), + execs(), ); } @@ -111,12 +111,12 @@ fn simple_cross_config() { .build(); let target = cross_compile::alternate(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); assert_that(&p.target_bin(&target, "foo"), existing_file()); assert_that( process(&p.target_bin(&target, "foo")), - execs().with_status(0), + execs(), ); } @@ -149,13 +149,13 @@ fn simple_deps() { let target = cross_compile::alternate(); assert_that( p.cargo("build").arg("--target").arg(&target), - execs().with_status(0), + execs(), ); assert_that(&p.target_bin(&target, "foo"), existing_file()); assert_that( process(&p.target_bin(&target, "foo")), - execs().with_status(0), + execs(), ); } @@ -245,13 +245,13 @@ fn plugin_deps() { let target = cross_compile::alternate(); assert_that( foo.cargo("build").arg("--target").arg(&target), - execs().with_status(0), + execs(), ); assert_that(&foo.target_bin(&target, "foo"), existing_file()); assert_that( process(&foo.target_bin(&target, "foo")), - execs().with_status(0), + execs(), ); } @@ -348,18 +348,18 @@ fn plugin_to_the_max() { let target = cross_compile::alternate(); assert_that( foo.cargo("build").arg("--target").arg(&target).arg("-v"), - execs().with_status(0), + execs(), ); println!("second"); assert_that( foo.cargo("build").arg("-v").arg("--target").arg(&target), - execs().with_status(0), + execs(), ); assert_that(&foo.target_bin(&target, "foo"), existing_file()); assert_that( process(&foo.target_bin(&target, "foo")), - execs().with_status(0), + execs(), ); } @@ -504,7 +504,7 @@ fn plugin_with_extra_dylib_dep() { let target = cross_compile::alternate(); assert_that( foo.cargo("build").arg("--target").arg(&target), - execs().with_status(0), + execs(), ); } @@ -559,7 +559,6 @@ fn cross_tests() { assert_that( p.cargo("test").arg("--target").arg(&target), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ({foo}) @@ -605,14 +604,14 @@ fn no_cross_doctests() { println!("a"); assert_that( p.cargo("test"), - execs().with_status(0).with_stderr(&host_output), + execs().with_stderr(&host_output), ); println!("b"); let target = cross_compile::host(); assert_that( p.cargo("test").arg("--target").arg(&target), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({foo}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -628,7 +627,7 @@ fn no_cross_doctests() { let target = cross_compile::alternate(); assert_that( p.cargo("test").arg("--target").arg(&target), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({foo}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -664,7 +663,7 @@ fn simple_cargo_run() { let target = cross_compile::alternate(); assert_that( p.cargo("run").arg("--target").arg(&target), - execs().with_status(0), + execs(), ); } @@ -717,7 +716,7 @@ fn cross_with_a_build_script() { assert_that( p.cargo("build").arg("--target").arg(&target).arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.0 (file://[..]) [RUNNING] `rustc [..] build.rs [..] --out-dir {dir}/target/debug/build/foo-[..]` @@ -817,7 +816,6 @@ fn build_script_needed_for_host_and_target() { assert_that( p.cargo("build").arg("--target").arg(&target).arg("-v"), execs() - .with_status(0) .with_stderr_contains(&format!( "[COMPILING] d1 v0.0.0 ({url}/d1)", url = p.url() @@ -899,7 +897,7 @@ fn build_deps_for_the_right_arch() { let target = cross_compile::alternate(); assert_that( p.cargo("build").arg("--target").arg(&target).arg("-v"), - execs().with_status(0), + execs(), ); } @@ -953,7 +951,7 @@ fn build_script_only_host() { let target = cross_compile::alternate(); assert_that( p.cargo("build").arg("--target").arg(&target).arg("-v"), - execs().with_status(0), + execs(), ); } @@ -986,7 +984,7 @@ fn plugin_build_script_right_arch() { .arg("-v") .arg("--target") .arg(cross_compile::alternate()), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] build.rs [..]` @@ -1051,7 +1049,7 @@ fn build_script_with_platform_specific_dependencies() { assert_that( p.cargo("build").arg("-v").arg("--target").arg(&target), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] d2 v0.0.0 ([..]) [RUNNING] `rustc [..] d2/src/lib.rs [..]` @@ -1206,10 +1204,10 @@ fn platform_specific_variables_reflected_in_build_scripts() { .file("d2/src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); assert_that( p.cargo("build").arg("-v").arg("--target").arg(&target), - execs().with_status(0), + execs(), ); } @@ -1288,7 +1286,6 @@ fn cross_test_dylib() { assert_that( p.cargo("test").arg("--target").arg(&target), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] bar v0.0.1 ({dir}/bar) diff --git a/tests/testsuite/cross_publish.rs b/tests/testsuite/cross_publish.rs index 54b7bda6db3..d1053a6ec04 100644 --- a/tests/testsuite/cross_publish.rs +++ b/tests/testsuite/cross_publish.rs @@ -44,7 +44,7 @@ fn simple_cross_package() { assert_that( p.cargo("package").arg("--target").arg(&target), - execs().with_status(0).with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( " Packaging foo v0.0.0 ({dir}) Verifying foo v0.0.0 ({dir}) Compiling foo v0.0.0 ({dir}/target/package/foo-0.0.0) @@ -121,7 +121,7 @@ fn publish_with_target() { .arg(publish::registry().to_string()) .arg("--target") .arg(&target), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( " Updating registry `{registry}` Packaging foo v0.0.0 ({dir}) Verifying foo v0.0.0 ({dir}) diff --git a/tests/testsuite/custom_target.rs b/tests/testsuite/custom_target.rs index 29605cf9bb8..03b153bc6fe 100644 --- a/tests/testsuite/custom_target.rs +++ b/tests/testsuite/custom_target.rs @@ -52,7 +52,7 @@ fn custom_target_minimal() { .arg("--target") .arg("custom-target.json") .arg("-v"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build") @@ -60,7 +60,7 @@ fn custom_target_minimal() { .arg("--target") .arg("src/../custom-target.json") .arg("-v"), - execs().with_status(0), + execs(), ); } @@ -146,6 +146,6 @@ fn custom_target_dependency() { .arg("--target") .arg("custom-target.json") .arg("-v"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/dep_info.rs b/tests/testsuite/dep_info.rs index 448c0d39f47..8c1a30eface 100644 --- a/tests/testsuite/dep_info.rs +++ b/tests/testsuite/dep_info.rs @@ -9,7 +9,7 @@ fn build_dep_info() { .file("src/foo.rs", &main_file(r#""i am foo""#, &[])) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let depinfo_bin_path = &p.bin("foo").with_extension("d"); @@ -37,7 +37,7 @@ fn build_dep_info_lib() { .file("examples/ex.rs", "") .build(); - assert_that(p.cargo("build").arg("--example=ex"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--example=ex"), execs()); assert_that( &p.example_lib("ex", "lib").with_extension("d"), existing_file(), @@ -64,7 +64,7 @@ fn build_dep_info_rlib() { .file("examples/ex.rs", "") .build(); - assert_that(p.cargo("build").arg("--example=ex"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--example=ex"), execs()); assert_that( &p.example_lib("ex", "rlib").with_extension("d"), existing_file(), @@ -91,7 +91,7 @@ fn build_dep_info_dylib() { .file("examples/ex.rs", "") .build(); - assert_that(p.cargo("build").arg("--example=ex"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--example=ex"), execs()); assert_that( &p.example_lib("ex", "dylib").with_extension("d"), existing_file(), @@ -104,10 +104,10 @@ fn no_rewrite_if_no_change() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let dep_info = p.root().join("target/debug/libfoo.d"); let metadata1 = dep_info.metadata().unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let metadata2 = dep_info.metadata().unwrap(); assert_eq!( diff --git a/tests/testsuite/directory.rs b/tests/testsuite/directory.rs index aa1c377372c..00934d496ba 100644 --- a/tests/testsuite/directory.rs +++ b/tests/testsuite/directory.rs @@ -100,7 +100,7 @@ fn simple() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.1.0 [COMPILING] foo v0.1.0 ([..]foo) @@ -136,7 +136,7 @@ fn simple_install() { assert_that( cargo_process("install bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( " Installing bar v0.1.0 Compiling foo v0.0.1 Compiling bar v0.1.0 @@ -219,7 +219,7 @@ fn install_without_feature_dep() { assert_that( cargo_process("install bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( " Installing bar v0.1.0 Compiling foo v0.0.1 Compiling bar v0.1.0 @@ -299,7 +299,7 @@ fn multiple() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.1.0 [COMPILING] foo v0.1.0 ([..]foo) @@ -333,7 +333,7 @@ fn crates_io_then_directory() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.1.0 ([..]) @@ -354,7 +354,7 @@ fn crates_io_then_directory() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.1.0 [COMPILING] foo v0.1.0 ([..]foo) @@ -384,7 +384,7 @@ fn crates_io_then_bad_checksum() { Package::new("bar", "0.1.0").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); setup(); VendorPackage::new("bar") @@ -481,7 +481,7 @@ fn only_dot_files_ok() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -514,7 +514,7 @@ fn random_files_ok() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -549,7 +549,7 @@ fn git_lock_file_doesnt_change() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let mut lock1 = String::new(); t!(t!(File::open(p.root().join("Cargo.lock"))).read_to_string(&mut lock1)); @@ -572,7 +572,7 @@ fn git_lock_file_doesnt_change() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] [..] [COMPILING] [..] diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index c19596c61ae..871f459a593 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -30,7 +30,7 @@ fn simple() { assert_that( p.cargo("doc"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [..] foo v0.0.1 ({dir}) [..] foo v0.0.1 ({dir}) @@ -62,7 +62,7 @@ fn doc_no_libs() { .file("src/main.rs", "bad code") .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); } #[test] @@ -73,7 +73,7 @@ fn doc_twice() { assert_that( p.cargo("doc"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [DOCUMENTING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -82,7 +82,7 @@ fn doc_twice() { )), ); - assert_that(p.cargo("doc"), execs().with_status(0).with_stdout("")) + assert_that(p.cargo("doc"), execs().with_stdout("")) } #[test] @@ -107,7 +107,7 @@ fn doc_deps() { assert_that( p.cargo("doc"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [..] bar v0.0.1 ({dir}/bar) [..] bar v0.0.1 ({dir}/bar) @@ -139,7 +139,7 @@ fn doc_deps() { assert_that( p.cargo("doc") .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint"), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); assert_that(&p.root().join("target/doc"), existing_dir()); @@ -169,7 +169,7 @@ fn doc_no_deps() { assert_that( p.cargo("doc").arg("--no-deps"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [CHECKING] bar v0.0.1 ({dir}/bar) [DOCUMENTING] foo v0.0.1 ({dir}) @@ -207,7 +207,7 @@ fn doc_only_bin() { .file("bar/src/lib.rs", "pub fn bar() {}") .build(); - assert_that(p.cargo("doc").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("doc").arg("-v"), execs()); assert_that(&p.root().join("target/doc"), existing_dir()); assert_that(&p.root().join("target/doc/bar/index.html"), existing_file()); @@ -297,7 +297,6 @@ fn doc_multiple_targets_same_name() { assert_that( p.cargo("doc").arg("--all"), execs() - .with_status(0) .with_stderr_contains(&format!("[DOCUMENTING] foo v0.1.0 ({}/foo)", root)) .with_stderr_contains(&format!("[DOCUMENTING] bar v0.1.0 ({}/bar)", root)) .with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), @@ -386,7 +385,7 @@ fn doc_multiple_targets_same_name_undoced() { .file("bar/src/foo-cli.rs", "") .build(); - assert_that(p.cargo("doc").arg("--all"), execs().with_status(0)); + assert_that(p.cargo("doc").arg("--all"), execs()); } #[test] @@ -413,7 +412,7 @@ fn doc_lib_bin_same_name_documents_lib() { assert_that( p.cargo("doc"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [DOCUMENTING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -457,7 +456,7 @@ fn doc_lib_bin_same_name_documents_lib_when_requested() { assert_that( p.cargo("doc").arg("--lib"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [DOCUMENTING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -501,7 +500,7 @@ fn doc_lib_bin_same_name_documents_named_bin_when_requested() { assert_that( p.cargo("doc").arg("--bin").arg("foo"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [CHECKING] foo v0.0.1 ({dir}) [DOCUMENTING] foo v0.0.1 ({dir}) @@ -546,7 +545,7 @@ fn doc_lib_bin_same_name_documents_bins_when_requested() { assert_that( p.cargo("doc").arg("--bins"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [CHECKING] foo v0.0.1 ({dir}) [DOCUMENTING] foo v0.0.1 ({dir}) @@ -602,7 +601,7 @@ fn doc_dash_p() { assert_that( p.cargo("doc").arg("-p").arg("a"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..] b v0.0.1 (file://[..]) [..] b v0.0.1 (file://[..]) @@ -622,7 +621,7 @@ fn doc_same_name() { .file("tests/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); } #[test] @@ -645,7 +644,7 @@ fn doc_target() { assert_that( p.cargo("doc").arg("--target").arg(TARGET).arg("--verbose"), - execs().with_status(0), + execs(), ); assert_that( &p.root().join(&format!("target/{}/doc", TARGET)), @@ -678,7 +677,7 @@ fn target_specific_not_documented() { .file("a/src/lib.rs", "not rust") .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); } #[test] @@ -767,7 +766,7 @@ fn target_specific_documented() { ) .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); } #[test] @@ -798,7 +797,7 @@ fn no_document_build_deps() { ) .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); } #[test] @@ -807,10 +806,10 @@ fn doc_release() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("--release"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--release"), execs()); assert_that( p.cargo("doc").arg("--release").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [DOCUMENTING] foo v0.0.1 ([..]) [RUNNING] `rustdoc [..] src/lib.rs [..]` @@ -852,7 +851,7 @@ fn doc_multiple_deps() { .arg("-p") .arg("baz") .arg("-v"), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("target/doc"), existing_dir()); @@ -903,7 +902,7 @@ fn features() { .build(); assert_that( p.cargo("doc").arg("--features").arg("foo"), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("target/doc"), existing_dir()); assert_that( @@ -928,12 +927,12 @@ fn rerun_when_dir_removed() { ) .build(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); assert_that(&p.root().join("target/doc/foo/index.html"), existing_file()); fs::remove_dir_all(p.root().join("target/doc/foo")).unwrap(); - assert_that(p.cargo("doc"), execs().with_status(0)); + assert_that(p.cargo("doc"), execs()); assert_that(&p.root().join("target/doc/foo/index.html"), existing_file()); } @@ -958,7 +957,7 @@ fn document_only_lib() { "#, ) .build(); - assert_that(p.cargo("doc").arg("--lib"), execs().with_status(0)); + assert_that(p.cargo("doc").arg("--lib"), execs()); assert_that(&p.root().join("target/doc/foo/index.html"), existing_file()); } @@ -986,7 +985,7 @@ fn plugins_no_use_target() { p.cargo("doc") .arg("--target=x86_64-unknown-openbsd") .arg("-v"), - execs().with_status(0), + execs(), ); } @@ -1015,7 +1014,6 @@ fn doc_all_workspace() { assert_that( p.cargo("doc").arg("--all"), execs() - .with_status(0) .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])") .with_stderr_contains("[..] Checking bar v0.1.0 ([..])") .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])"), @@ -1042,7 +1040,6 @@ fn doc_all_virtual_manifest() { assert_that( p.cargo("doc").arg("--all"), execs() - .with_status(0) .with_stderr_contains("[..] Documenting baz v0.1.0 ([..])") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])"), ); @@ -1068,7 +1065,6 @@ fn doc_virtual_manifest_all_implied() { assert_that( p.cargo("doc"), execs() - .with_status(0) .with_stderr_contains("[..] Documenting baz v0.1.0 ([..])") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])"), ); @@ -1107,7 +1103,6 @@ fn doc_all_member_dependency_same_name() { assert_that( p.cargo("doc").arg("--all"), execs() - .with_status(0) .with_stderr_contains("[..] Updating registry `[..]`") .with_stderr_contains("[..] Documenting bar v0.1.0 ([..])"), ); @@ -1176,7 +1171,6 @@ fn doc_workspace_open_different_library_and_package_names() { assert_that( p.cargo("doc --open").env("BROWSER", "echo"), execs() - .with_status(0) .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])") .with_stderr_contains("[..] Opening [..]/foo/target/doc/foolib/index.html") ); @@ -1210,7 +1204,6 @@ fn doc_workspace_open_binary() { assert_that( p.cargo("doc --open").env("BROWSER", "echo"), execs() - .with_status(0) .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])") .with_stderr_contains("[..] Opening [..]/foo/target/doc/foobin/index.html") ); @@ -1247,7 +1240,6 @@ fn doc_workspace_open_binary_and_library() { assert_that( p.cargo("doc --open").env("BROWSER", "echo"), execs() - .with_status(0) .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])") .with_stderr_contains("[..] Opening [..]/foo/target/doc/foolib/index.html") ); @@ -1278,14 +1270,12 @@ fn doc_edition() { assert_that( p.cargo("doc -v").masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustdoc [..]-Zunstable-options --edition=2018[..]"), ); assert_that( p.cargo("test -v").masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustdoc [..]-Zunstable-options --edition=2018[..]") ); } @@ -1315,14 +1305,12 @@ fn doc_target_edition() { assert_that( p.cargo("doc -v").masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustdoc [..]-Zunstable-options --edition=2018[..]"), ); assert_that( p.cargo("test -v").masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustdoc [..]-Zunstable-options --edition=2018[..]") ); } @@ -1356,8 +1344,8 @@ fn issue_5345() { Package::new("bar", "0.1.0").publish(); Package::new("bar", "0.2.0").publish(); - assert_that(foo.cargo("build"), execs().with_status(0)); - assert_that(foo.cargo("doc"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); + assert_that(foo.cargo("doc"), execs()); } #[test] @@ -1365,7 +1353,7 @@ fn doc_private_items() { let foo = project() .file("src/lib.rs", "mod private { fn private_item() {} }") .build(); - assert_that(foo.cargo("doc").arg("--document-private-items"), execs().with_status(0)); + assert_that(foo.cargo("doc").arg("--document-private-items"), execs()); assert_that(&foo.root().join("target/doc"), existing_dir()); assert_that(&foo.root().join("target/doc/foo/private/index.html"), existing_file()); @@ -1410,7 +1398,7 @@ fn doc_cap_lints() { assert_that( p.cargo("doc"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [UPDATING] git repository `[..]` [DOCUMENTING] a v0.5.0 ([..]) @@ -1425,7 +1413,7 @@ fn doc_cap_lints() { assert_that( p.cargo("doc -vv"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] `[bad_link]` cannot be resolved, ignoring it... ", diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index 97eaa039cb9..b70d0c13d16 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -298,7 +298,7 @@ fn invalid9() { .build(); assert_that(p.cargo("build").arg("--features").arg("bar"), - execs().with_status(0).with_stderr("\ + execs().with_stderr("\ warning: Package `foo v0.0.1 ([..])` does not have feature `bar`. It has a required dependency with \ that name, but only optional dependencies can be used as features. [..] Compiling bar v0.0.1 ([..]) @@ -342,7 +342,7 @@ fn invalid10() { .build(); assert_that(p.cargo("build"), - execs().with_status(0).with_stderr("\ + execs().with_stderr("\ warning: Package `bar v0.0.1 ([..])` does not have feature `baz`. It has a required dependency with \ that name, but only optional dependencies can be used as features. [..] Compiling baz v0.0.1 ([..]) @@ -451,7 +451,7 @@ fn no_feature_doesnt_build() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -461,12 +461,12 @@ fn no_feature_doesnt_build() { ); assert_that( p.process(&p.bin("foo")), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); assert_that( p.cargo("build").arg("--features").arg("bar"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] bar v0.0.1 ({dir}/bar) [COMPILING] foo v0.0.1 ({dir}) @@ -477,7 +477,7 @@ fn no_feature_doesnt_build() { ); assert_that( p.process(&p.bin("foo")), - execs().with_status(0).with_stdout("bar\n"), + execs().with_stdout("bar\n"), ); } @@ -517,7 +517,7 @@ fn default_feature_pulled_in() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] bar v0.0.1 ({dir}/bar) [COMPILING] foo v0.0.1 ({dir}) @@ -528,12 +528,12 @@ fn default_feature_pulled_in() { ); assert_that( p.process(&p.bin("foo")), - execs().with_status(0).with_stdout("bar\n"), + execs().with_stdout("bar\n"), ); assert_that( p.cargo("build").arg("--no-default-features"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -543,7 +543,7 @@ fn default_feature_pulled_in() { ); assert_that( p.process(&p.bin("foo")), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); } @@ -592,7 +592,7 @@ fn cyclic_feature2() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -643,7 +643,7 @@ fn groups_on_groups_on_groups() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) @@ -693,7 +693,7 @@ fn many_cli_features() { assert_that( p.cargo("build").arg("--features").arg("bar baz"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) @@ -778,7 +778,7 @@ fn union_features() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] d2 v0.0.1 ({dir}/d2) [COMPILING] d1 v0.0.1 ({dir}/d1) @@ -826,7 +826,7 @@ fn many_features_no_rebuilds() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] a v0.1.0 ({dir}/a) [COMPILING] b v0.1.0 ({dir}) @@ -839,7 +839,7 @@ fn many_features_no_rebuilds() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] a v0.1.0 ([..]/a) [FRESH] b v0.1.0 ([..]) @@ -858,7 +858,7 @@ fn empty_features() { assert_that( p.cargo("build").arg("--features").arg(""), - execs().with_status(0), + execs(), ); } @@ -899,7 +899,7 @@ fn transitive_features() { assert_that( p.cargo("build").arg("--features").arg("foo"), - execs().with_status(0), + execs(), ); } @@ -959,7 +959,7 @@ fn everything_in_the_lockfile() { .file("d3/src/lib.rs", "") .build(); - assert_that(p.cargo("fetch"), execs().with_status(0)); + assert_that(p.cargo("fetch"), execs()); let loc = p.root().join("Cargo.lock"); let mut lockfile = String::new(); t!(t!(File::open(&loc)).read_to_string(&mut lockfile)); @@ -1026,9 +1026,9 @@ fn no_rebuild_when_frobbing_default_feature() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("build"), execs().with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -1077,9 +1077,9 @@ fn unions_work_with_no_default_features() { .file("a/src/lib.rs", r#"#[cfg(feature = "f1")] pub fn a() {}"#) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("build"), execs().with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -1106,7 +1106,7 @@ fn optional_and_dev_dep() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] test v0.1.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -1151,7 +1151,7 @@ fn activating_feature_activates_dep() { assert_that( p.cargo("build").arg("--features").arg("a").arg("-v"), - execs().with_status(0), + execs(), ); } @@ -1225,7 +1225,7 @@ fn dep_feature_in_cmd_line() { p.cargo("build") .arg("--features") .arg("derived/derived-feat"), - execs().with_status(0), + execs(), ); // Trying to enable features of transitive dependencies is an error @@ -1291,7 +1291,7 @@ fn all_features_flag_enables_all_features() { assert_that( p.cargo("build").arg("--all-features"), - execs().with_status(0), + execs(), ); } @@ -1333,7 +1333,7 @@ fn many_cli_features_comma_delimited() { assert_that( p.cargo("build").arg("--features").arg("bar,baz"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) @@ -1399,7 +1399,7 @@ fn many_cli_features_comma_and_space_delimited() { assert_that( p.cargo("build").arg("--features").arg("bar,baz bam bap"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) [COMPILING] ba[..] v0.0.1 ({dir}/ba[..]) @@ -1491,12 +1491,12 @@ fn combining_features_and_package() { assert_that( p.cargo("build -Z package-features --all --all-features") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); assert_that( p.cargo("run -Z package-features --package bar --features main") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } @@ -1632,7 +1632,7 @@ fn namespaced_implicit_feature() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } @@ -1777,7 +1777,7 @@ fn namespaced_same_name() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } @@ -1809,7 +1809,7 @@ fn only_dep_is_optional() { assert_that( p.cargo("build"), - execs().with_status(0), + execs(), ); } @@ -1848,6 +1848,6 @@ fn all_features_all_crates() { assert_that( p.cargo("build --all-features --all"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/fetch.rs b/tests/testsuite/fetch.rs index 3e64c9f0698..ce63f05c429 100644 --- a/tests/testsuite/fetch.rs +++ b/tests/testsuite/fetch.rs @@ -10,7 +10,7 @@ fn no_deps() { .file("src/a.rs", "") .build(); - assert_that(p.cargo("fetch"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("fetch"), execs().with_stdout("")); } #[test] @@ -53,7 +53,6 @@ fn fetch_all_platform_dependencies_when_no_target_is_given() { assert_that( p.cargo("fetch"), execs() - .with_status(0) .with_stderr_contains("[..] Downloading d1 v1.2.3 [..]") .with_stderr_contains("[..] Downloading d2 v0.1.2 [..]"), ); @@ -99,7 +98,6 @@ fn fetch_platform_specific_dependencies() { assert_that( p.cargo("fetch").arg("--target").arg(&host), execs() - .with_status(0) .with_stderr_contains("[..] Downloading d1 v1.2.3 [..]") .with_stderr_does_not_contain("[..] Downloading d2 v0.1.2 [..]"), ); @@ -107,7 +105,6 @@ fn fetch_platform_specific_dependencies() { assert_that( p.cargo("fetch").arg("--target").arg(&target), execs() - .with_status(0) .with_stderr_contains("[..] Downloading d2 v0.1.2[..]") .with_stderr_does_not_contain("[..] Downloading d1 v1.2.3 [..]"), ); diff --git a/tests/testsuite/fix.rs b/tests/testsuite/fix.rs index d26fc32dc5b..0ad9d5502f3 100644 --- a/tests/testsuite/fix.rs +++ b/tests/testsuite/fix.rs @@ -50,7 +50,7 @@ fn fix_broken_if_requested() { assert_that( p.cargo("fix --allow-no-vcs --broken-code") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0), + execs(), ); } @@ -124,7 +124,7 @@ fn broken_fixes_backed_out() { // Build our rustc shim assert_that( p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0), + execs(), ); // Attempt to fix code, but our shim will always fail the second compile @@ -199,7 +199,6 @@ fn fix_path_deps() { p.cargo("fix --allow-no-vcs -p foo -p bar") .env("__CARGO_FIX_YOLO", "1"), execs() - .with_status(0) .with_stdout("") .with_stderr("\ [CHECKING] bar v0.1.0 ([..]) @@ -245,7 +244,7 @@ fn do_not_fix_non_relevant_deps() { p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1") .cwd(p.root().join("foo")), - execs().with_status(0) + execs() ); assert!(p.read_file("bar/src/lib.rs").contains("mut")); @@ -285,7 +284,7 @@ fn prepare_for_2018() { "; assert_that( p.cargo("fix --edition --allow-no-vcs"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); println!("{}", p.read_file("src/lib.rs")); @@ -325,7 +324,7 @@ fn local_paths() { assert_that( p.cargo("fix --edition --allow-no-vcs"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); println!("{}", p.read_file("src/lib.rs")); @@ -363,7 +362,7 @@ issues in preparation for the 2018 edition "; assert_that( p.cargo("fix --edition --allow-no-vcs"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); } @@ -417,7 +416,7 @@ fn upgrade_extern_crate() { p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1") .masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); println!("{}", p.read_file("src/lib.rs")); assert!(!p.read_file("src/lib.rs").contains("extern crate")); @@ -454,7 +453,7 @@ fn specify_rustflags() { assert_that( p.cargo("fix --edition --allow-no-vcs") .env("RUSTFLAGS", "-C target-cpu=native"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); } @@ -470,7 +469,7 @@ fn no_changes_necessary() { "; assert_that( p.cargo("fix --allow-no-vcs"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); } @@ -496,7 +495,7 @@ fn fixes_extra_mut() { assert_that( p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); } @@ -523,7 +522,7 @@ fn fixes_two_missing_ampersands() { assert_that( p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); } @@ -549,7 +548,7 @@ fn tricky() { assert_that( p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0).with_stderr(stderr).with_stdout(""), + execs().with_stderr(stderr).with_stdout(""), ); } @@ -568,7 +567,7 @@ fn preserve_line_endings() { assert_that( p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0), + execs(), ); assert!(p.read_file("src/lib.rs").contains("\r\n")); } @@ -588,7 +587,7 @@ fn fix_deny_warnings() { assert_that( p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0), + execs(), ); } @@ -613,7 +612,7 @@ fn fix_deny_warnings_but_not_others() { assert_that( p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0), + execs(), ); assert!(!p.read_file("src/lib.rs").contains("let mut x = 3;")); assert!(p.read_file("src/lib.rs").contains("fn bar() {}")); @@ -649,7 +648,6 @@ fn fix_two_files() { p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), execs() - .with_status(0) .with_stderr_contains("[FIXING] src/bar.rs (1 fix)") .with_stderr_contains("[FIXING] src/lib.rs (1 fix)"), ); @@ -685,7 +683,6 @@ fn fixes_missing_ampersand() { p.cargo("fix --all-targets --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), execs() - .with_status(0) .with_stdout("") .with_stderr_contains("[COMPILING] foo v0.0.1 ([..])") .with_stderr_contains("[FIXING] build.rs (1 fix)") @@ -700,8 +697,8 @@ fn fixes_missing_ampersand() { .with_stderr_contains("[FIXING] tests/a.rs (1 fix)") .with_stderr_contains("[FINISHED] [..]"), ); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("test"), execs()); } #[test] @@ -729,10 +726,10 @@ fn fix_features() { ) .build(); - assert_that(p.cargo("fix --allow-no-vcs"), execs().with_status(0)); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("fix --features bar --allow-no-vcs"), execs().with_status(0)); - assert_that(p.cargo("build --features bar"), execs().with_status(0)); + assert_that(p.cargo("fix --allow-no-vcs"), execs()); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("fix --features bar --allow-no-vcs"), execs()); + assert_that(p.cargo("build --features bar"), execs()); } #[test] @@ -743,7 +740,7 @@ fn shows_warnings() { assert_that( p.cargo("fix --allow-no-vcs"), - execs().with_status(0).with_stderr_contains("[..]warning: unused import[..]"), + execs().with_stderr_contains("[..]warning: unused import[..]"), ); } @@ -764,7 +761,7 @@ destructive changes; if you'd like to suppress this error pass `--allow-no-vcs`\ ); assert_that( p.cargo("fix --allow-no-vcs"), - execs().with_status(0), + execs(), ); } @@ -800,7 +797,7 @@ these files: ); assert_that( p.cargo("fix --allow-dirty"), - execs().with_status(0), + execs(), ); } @@ -820,7 +817,7 @@ fn does_not_warn_about_clean_working_directory() { assert_that( p.cargo("fix"), - execs().with_status(0), + execs(), ); } @@ -842,7 +839,7 @@ fn does_not_warn_about_dirty_ignored_files() { assert_that( p.cargo("fix"), - execs().with_status(0), + execs(), ); } @@ -855,7 +852,7 @@ fn fix_all_targets_by_default() { assert_that( p.cargo("fix --allow-no-vcs") .env("__CARGO_FIX_YOLO", "1"), - execs().with_status(0), + execs(), ); assert!(!p.read_file("src/lib.rs").contains("let mut x")); assert!(!p.read_file("tests/foo.rs").contains("let mut x")); @@ -921,9 +918,7 @@ issues in preparation for the 2018 edition assert_that( p.cargo("fix --edition --allow-no-vcs") .masquerade_as_nightly_cargo(), - execs() - .with_stderr(stderr) - .with_status(0), + execs().with_stderr(stderr), ); } @@ -958,7 +953,7 @@ fn fix_overlapping() { assert_that( p.cargo("fix --allow-no-vcs --prepare-for 2018 --lib"), - execs().with_status(0).with_stderr(stderr), + execs().with_stderr(stderr), ); let contents = p.read_file("src/lib.rs"); diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 7f502465903..b6ad583c5e9 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -16,7 +16,7 @@ fn modifying_and_moving() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -25,7 +25,7 @@ fn modifying_and_moving() { )), ); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); p.root().move_into_the_past(); p.root().join("target").move_into_the_past(); @@ -35,7 +35,7 @@ fn modifying_and_moving() { .unwrap(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -60,7 +60,7 @@ fn modify_only_some_files() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -68,7 +68,7 @@ fn modify_only_some_files() { dir = path2url(p.root()) )), ); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); sleep_ms(1000); assert_that(&p.bin("foo"), existing_file()); @@ -89,7 +89,7 @@ fn modify_only_some_files() { // Make sure the binary is rebuilt, not the lib assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -134,21 +134,21 @@ fn rebuild_sub_package_then_while_package() { .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); File::create(&p.root().join("b/src/lib.rs")) .unwrap() .write_all(br#"pub fn b() {}"#) .unwrap(); - assert_that(p.cargo("build").arg("-pb"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-pb"), execs()); File::create(&p.root().join("src/lib.rs")) .unwrap() .write_all(br#"extern crate a; extern crate b; pub fn toplevel() {}"#) .unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -171,7 +171,7 @@ fn changing_lib_features_caches_targets() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..]Compiling foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -181,7 +181,7 @@ fn changing_lib_features_caches_targets() { assert_that( p.cargo("build").arg("--features").arg("foo"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..]Compiling foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -194,16 +194,14 @@ fn changing_lib_features_caches_targets() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); assert_that( p.cargo("build").arg("--features").arg("foo"), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); } @@ -228,7 +226,7 @@ fn changing_profiles_caches_targets() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..]Compiling foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -238,7 +236,7 @@ fn changing_profiles_caches_targets() { assert_that( p.cargo("test"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..]Compiling foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -253,13 +251,12 @@ fn changing_profiles_caches_targets() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("test").arg("foo"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] target[..]debug[..]deps[..]foo-[..][EXE] @@ -357,7 +354,7 @@ fn changing_bin_paths_common_target_features_caches_targets() { /* Build and rebuild a/. Ensure dep_crate only builds once */ assert_that( p.cargo("run").cwd(p.root().join("a")), - execs().with_status(0).with_stdout("ftest off").with_stderr( + execs().with_stdout("ftest off").with_stderr( "\ [..]Compiling dep_crate v0.0.1 ([..]) [..]Compiling a v0.0.1 ([..]) @@ -368,11 +365,11 @@ fn changing_bin_paths_common_target_features_caches_targets() { ); assert_that( p.cargo("clean").arg("-p").arg("a").cwd(p.root().join("a")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("run").cwd(p.root().join("a")), - execs().with_status(0).with_stdout("ftest off").with_stderr( + execs().with_stdout("ftest off").with_stderr( "\ [..]Compiling a v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -384,7 +381,7 @@ fn changing_bin_paths_common_target_features_caches_targets() { /* Build and rebuild b/. Ensure dep_crate only builds once */ assert_that( p.cargo("run").cwd(p.root().join("b")), - execs().with_status(0).with_stdout("ftest on").with_stderr( + execs().with_stdout("ftest on").with_stderr( "\ [..]Compiling dep_crate v0.0.1 ([..]) [..]Compiling b v0.0.1 ([..]) @@ -395,11 +392,11 @@ fn changing_bin_paths_common_target_features_caches_targets() { ); assert_that( p.cargo("clean").arg("-p").arg("b").cwd(p.root().join("b")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("run").cwd(p.root().join("b")), - execs().with_status(0).with_stdout("ftest on").with_stderr( + execs().with_stdout("ftest on").with_stderr( "\ [..]Compiling b v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -412,11 +409,11 @@ fn changing_bin_paths_common_target_features_caches_targets() { * this should not cause a rebuild of dep_crate */ assert_that( p.cargo("clean").arg("-p").arg("a").cwd(p.root().join("a")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("run").cwd(p.root().join("a")), - execs().with_status(0).with_stdout("ftest off").with_stderr( + execs().with_stdout("ftest off").with_stderr( "\ [..]Compiling a v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -429,11 +426,11 @@ fn changing_bin_paths_common_target_features_caches_targets() { * this should not cause a rebuild */ assert_that( p.cargo("clean").arg("-p").arg("b").cwd(p.root().join("b")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("run").cwd(p.root().join("b")), - execs().with_status(0).with_stdout("ftest on").with_stderr( + execs().with_stdout("ftest on").with_stderr( "\ [..]Compiling b v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -482,7 +479,7 @@ fn changing_bin_features_caches_targets() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -491,12 +488,12 @@ fn changing_bin_features_caches_targets() { ); assert_that( foo_proc("off1"), - execs().with_status(0).with_stdout("feature off"), + execs().with_stdout("feature off"), ); assert_that( p.cargo("build").arg("--features").arg("foo"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -505,14 +502,14 @@ fn changing_bin_features_caches_targets() { ); assert_that( foo_proc("on1"), - execs().with_status(0).with_stdout("feature on"), + execs().with_stdout("feature on"), ); /* Targets should be cached from the first build */ assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", @@ -520,12 +517,12 @@ fn changing_bin_features_caches_targets() { ); assert_that( foo_proc("off2"), - execs().with_status(0).with_stdout("feature off"), + execs().with_stdout("feature off"), ); assert_that( p.cargo("build").arg("--features").arg("foo"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", @@ -533,7 +530,7 @@ fn changing_bin_features_caches_targets() { ); assert_that( foo_proc("on2"), - execs().with_status(0).with_stdout("feature on"), + execs().with_stdout("feature on"), ); } @@ -551,13 +548,13 @@ fn rebuild_tests_if_lib_changes() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("test"), execs()); sleep_ms(1000); File::create(&p.root().join("src/lib.rs")).unwrap(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); assert_that(p.cargo("test").arg("-v"), execs().with_status(101)); } @@ -610,10 +607,10 @@ fn no_rebuild_transitive_target_deps() { .file("c/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("test").arg("--no-run"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] c v0.0.1 ([..]) [COMPILING] b v0.0.1 ([..]) @@ -661,8 +658,8 @@ fn rerun_if_changed_in_dep() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -730,7 +727,7 @@ fn same_build_dir_cached_packages() { assert_that( p.cargo("build").cwd(p.root().join("a1")), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] d v0.0.1 ({dir}/d) [COMPILING] c v0.0.1 ({dir}/c) @@ -743,7 +740,7 @@ fn same_build_dir_cached_packages() { ); assert_that( p.cargo("build").cwd(p.root().join("a2")), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] a2 v0.0.1 ({dir}/a2) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -773,14 +770,13 @@ fn no_rebuild_if_build_artifacts_move_backwards_in_time() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); p.root().move_into_the_past(); assert_that( p.cargo("build"), execs() - .with_status(0) .with_stdout("") .with_stderr("[FINISHED] [..]"), ); @@ -806,13 +802,13 @@ fn rebuild_if_build_artifacts_move_forward_in_time() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); p.root().move_into_the_future(); assert_that( p.cargo("build").env("RUST_LOG", ""), - execs().with_status(0).with_stdout("").with_stderr( + execs().with_stdout("").with_stderr( "\ [COMPILING] a v0.0.1 ([..]) [COMPILING] foo v0.0.1 ([..]) @@ -848,7 +844,6 @@ fn rebuild_if_environment_changes() { assert_that( p.cargo("run"), execs() - .with_status(0) .with_stdout("old desc") .with_stderr(&format!( "\ @@ -876,7 +871,6 @@ fn rebuild_if_environment_changes() { assert_that( p.cargo("run"), execs() - .with_status(0) .with_stdout("new desc") .with_stderr(&format!( "\ @@ -909,7 +903,7 @@ fn no_rebuild_when_rename_dir() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let mut new = p.root(); new.pop(); new.push("bar"); @@ -918,7 +912,6 @@ fn no_rebuild_when_rename_dir() { assert_that( p.cargo("build").cwd(&new), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); } @@ -973,10 +966,10 @@ fn unused_optional_dep() { .file("baz/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -1030,10 +1023,10 @@ fn path_dev_dep_registry_updates() { .file("baz/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -1070,8 +1063,8 @@ fn change_panic_mode() { .file("baz/src/lib.rs", "extern crate bar;") .build(); - assert_that(p.cargo("build -p bar"), execs().with_status(0)); - assert_that(p.cargo("build -p baz"), execs().with_status(0)); + assert_that(p.cargo("build -p bar"), execs()); + assert_that(p.cargo("build -p baz"), execs()); } #[test] @@ -1123,15 +1116,15 @@ fn dont_rebuild_based_on_plugins() { .file("qux/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("build -p baz"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("build -p baz"), execs()); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]\n"), + execs().with_stderr("[FINISHED] [..]\n"), ); assert_that( p.cargo("build -p bar"), - execs().with_status(0).with_stderr("[FINISHED] [..]\n"), + execs().with_stderr("[FINISHED] [..]\n"), ); } @@ -1156,10 +1149,10 @@ fn reuse_workspace_lib() { .file("baz/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("test -p baz -v --no-run"), - execs().with_status(0).with_stderr("\ + execs().with_stderr("\ [COMPILING] baz v0.1.1 ([..]) [RUNNING] `rustc[..] --test [..]` [FINISHED] [..] diff --git a/tests/testsuite/generate_lockfile.rs b/tests/testsuite/generate_lockfile.rs index cac4fc1cadb..d291f9623ba 100644 --- a/tests/testsuite/generate_lockfile.rs +++ b/tests/testsuite/generate_lockfile.rs @@ -14,7 +14,7 @@ fn adding_and_removing_packages() { .file("bar/src/lib.rs", "") .build(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); let toml = p.root().join("Cargo.toml"); let lock1 = p.read_lockfile(); @@ -34,7 +34,7 @@ fn adding_and_removing_packages() { "#, ) .unwrap(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); let lock2 = p.read_lockfile(); assert_ne!(lock1, lock2); @@ -43,7 +43,7 @@ fn adding_and_removing_packages() { .unwrap() .write_all(basic_manifest("bar", "0.0.2").as_bytes()) .unwrap(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); let lock3 = p.read_lockfile(); assert_ne!(lock1, lock3); assert_ne!(lock2, lock3); @@ -61,7 +61,7 @@ fn adding_and_removing_packages() { "#, ) .unwrap(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); let lock4 = p.read_lockfile(); assert_eq!(lock1, lock4); } @@ -95,7 +95,7 @@ fn no_index_update() { p.cargo("generate-lockfile") .masquerade_as_nightly_cargo() .arg("-Zno-index-update"), - execs().with_status(0).with_stdout("").with_stderr(""), + execs().with_stdout("").with_stderr(""), ); } @@ -107,7 +107,7 @@ fn preserve_metadata() { .file("bar/src/lib.rs", "") .build(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); let metadata = r#" [metadata] @@ -123,12 +123,12 @@ foo = "bar" .unwrap(); // Build and make sure the metadata is still there - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let lock = p.read_lockfile(); assert!(lock.contains(metadata.trim()), "{}", lock); // Update and make sure the metadata is still there - assert_that(p.cargo("update"), execs().with_status(0)); + assert_that(p.cargo("update"), execs()); let lock = p.read_lockfile(); assert!(lock.contains(metadata.trim()), "{}", lock); } @@ -142,9 +142,9 @@ fn preserve_line_endings_issue_2076() { .build(); let lockfile = p.root().join("Cargo.lock"); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); assert_that(&lockfile, existing_file()); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); let lock0 = p.read_lockfile(); @@ -158,7 +158,7 @@ fn preserve_line_endings_issue_2076() { .unwrap(); } - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); let lock2 = p.read_lockfile(); @@ -174,13 +174,13 @@ fn cargo_update_generate_lockfile() { let lockfile = p.root().join("Cargo.lock"); assert_that(&lockfile, is_not(existing_file())); - assert_that(p.cargo("update"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("update"), execs().with_stdout("")); assert_that(&lockfile, existing_file()); fs::remove_file(p.root().join("Cargo.lock")).unwrap(); assert_that(&lockfile, is_not(existing_file())); - assert_that(p.cargo("update"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("update"), execs().with_stdout("")); assert_that(&lockfile, existing_file()); } diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index a02730958a7..a805fc5cf8b 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -151,7 +151,7 @@ fn cargo_compile_offline_with_cached_git_dep() { ) .file("src/main.rs", "fn main(){}") .build(); - assert_that(prj.cargo("build"), execs().with_status(0)); + assert_that(prj.cargo("build"), execs()); File::create(&prj.root().join("Cargo.toml")) .unwrap() @@ -169,7 +169,7 @@ fn cargo_compile_offline_with_cached_git_dep() { rev2.clone() ).as_bytes()) .unwrap(); - assert_that(prj.cargo("build"), execs().with_status(0)); + assert_that(prj.cargo("build"), execs()); } let p = project() @@ -389,7 +389,7 @@ fn cargo_compile_git_dep_tag() { execs().with_stdout("hello world\n"), ); - assert_that(project.cargo("build"), execs().with_status(0)); + assert_that(project.cargo("build"), execs()); } #[test] @@ -627,7 +627,7 @@ fn cargo_compile_with_short_ssh_git() { assert_that( p.cargo("build"), - execs().with_stdout("").with_stderr(&format!( + execs().with_status(101).with_stdout("").with_stderr(&format!( "\ [ERROR] failed to parse manifest at `[..]` @@ -720,9 +720,9 @@ fn two_revs_same_deps() { ) .build(); - assert_that(foo.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(foo.cargo("build").arg("-v"), execs()); assert_that(&foo.bin("foo"), existing_file()); - assert_that(foo.process(&foo.bin("foo")), execs().with_status(0)); + assert_that(foo.process(&foo.bin("foo")), execs()); } #[test] @@ -1050,15 +1050,13 @@ fn dep_with_submodule() { assert_that( project.cargo("build"), - execs() - .with_stderr( - "\ + execs().with_stderr( + "\ [UPDATING] git repository [..] [COMPILING] dep1 [..] [COMPILING] foo [..] [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n", - ) - .with_status(0), + ), ); } @@ -1241,8 +1239,8 @@ fn stale_cached_version() { ) .build(); - assert_that(foo.cargo("build"), execs().with_status(0)); - assert_that(foo.process(&foo.bin("foo")), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); + assert_that(foo.process(&foo.bin("foo")), execs()); // Update the repo, and simulate someone else updating the lockfile and then // us pulling it down. @@ -1284,7 +1282,7 @@ fn stale_cached_version() { // Now build! assert_that( foo.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] git repository `{bar}` [COMPILING] bar v0.0.0 ({bar}#[..]) @@ -1295,7 +1293,7 @@ fn stale_cached_version() { foo = foo.url() )), ); - assert_that(foo.process(&foo.bin("foo")), execs().with_status(0)); + assert_that(foo.process(&foo.bin("foo")), execs()); } #[test] @@ -1353,8 +1351,7 @@ fn dep_with_changed_submodule() { [..]\n\ [RUNNING] `target/debug/foo[EXE]`\n", ) - .with_stdout("project2\n") - .with_status(0), + .with_stdout("project2\n"), ); File::create(&git_project.root().join(".gitmodules")) @@ -1411,8 +1408,7 @@ fn dep_with_changed_submodule() { [..]\n\ [RUNNING] `target/debug/foo[EXE]`\n", ) - .with_stdout("project3\n") - .with_status(0), + .with_stdout("project3\n"), ); } @@ -1516,7 +1512,7 @@ fn git_build_cmd_freshness() { assert_that( foo.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ({url}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -1527,12 +1523,12 @@ fn git_build_cmd_freshness() { // Smoke test to make sure it doesn't compile again println!("first pass"); - assert_that(foo.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(foo.cargo("build"), execs().with_stdout("")); // Modify an ignored file and make sure we don't rebuild println!("second pass"); File::create(&foo.root().join("src/bar.rs")).unwrap(); - assert_that(foo.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(foo.cargo("build"), execs().with_stdout("")); } #[test] @@ -1733,7 +1729,7 @@ fn git_dep_build_cmd() { p.root().join("bar").move_into_the_past(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(process(&p.bin("foo")), execs().with_stdout("0\n")); @@ -1743,7 +1739,7 @@ fn git_dep_build_cmd() { .write_all(b"pub fn gimme() -> i32 { 1 }") .unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(process(&p.bin("foo")), execs().with_stdout("1\n")); } @@ -1775,13 +1771,13 @@ fn fetch_downloads() { .build(); assert_that( p.cargo("fetch"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "[UPDATING] git repository `{url}`", url = bar.url() )), ); - assert_that(p.cargo("fetch"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("fetch"), execs().with_stdout("")); } #[test] @@ -1877,7 +1873,7 @@ fn update_ambiguous() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); assert_that( p.cargo("update").arg("-p").arg("bar"), execs().with_status(101).with_stderr( @@ -1924,11 +1920,10 @@ fn update_one_dep_in_repo_with_many_deps() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); assert_that( p.cargo("update").arg("-p").arg("bar"), execs() - .with_status(0) .with_stderr(&format!("[UPDATING] git repository `{}`", bar.url())), ); } @@ -1999,7 +1994,7 @@ fn switch_deps_does_not_update_transitive() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] git repository `{}` [UPDATING] git repository `{}` @@ -2034,7 +2029,7 @@ fn switch_deps_does_not_update_transitive() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] git repository `{}` [COMPILING] dep [..] @@ -2085,7 +2080,7 @@ fn update_one_source_updates_all_packages_in_that_git_source() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let repo = git2::Repository::open(&dep.root()).unwrap(); let rev1 = repo.revparse_single("HEAD").unwrap().id(); @@ -2100,7 +2095,7 @@ fn update_one_source_updates_all_packages_in_that_git_source() { assert_that( p.cargo("update").arg("-p").arg("dep"), - execs().with_status(0), + execs(), ); let mut lockfile = String::new(); File::open(&p.root().join("Cargo.lock")) @@ -2160,7 +2155,7 @@ fn switch_sources() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `file://[..]a1` [COMPILING] a v0.5.0 ([..]a1#[..] @@ -2190,7 +2185,7 @@ fn switch_sources() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `file://[..]a2` [COMPILING] a v0.5.1 ([..]a2#[..] @@ -2233,7 +2228,7 @@ fn dont_require_submodules_are_checked_out() { assert_that( git1.cargo("build").arg("-v").cwd(&dst), - execs().with_status(0), + execs(), ); } @@ -2286,7 +2281,7 @@ fn doctest_same_name() { ) .build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } #[test] @@ -2322,7 +2317,7 @@ fn lints_are_suppressed() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `[..]` [COMPILING] a v0.5.0 ([..]) @@ -2367,7 +2362,7 @@ fn denied_lints_are_allowed() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `[..]` [COMPILING] a v0.5.0 ([..]) @@ -2407,7 +2402,7 @@ fn add_a_git_dep() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); File::create(p.root().join("a/Cargo.toml")) .unwrap() @@ -2427,7 +2422,7 @@ fn add_a_git_dep() { ) .unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -2470,8 +2465,8 @@ fn two_at_rev_instead_of_tag() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -2538,7 +2533,7 @@ fn include_overrides_gitignore() { println!("build 1: all is new"); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] filetime [..] @@ -2559,7 +2554,7 @@ fn include_overrides_gitignore() { println!("build 2: nothing changed; file timestamps reset by build script"); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] libc [..] [FRESH] filetime [..] @@ -2575,7 +2570,7 @@ fn include_overrides_gitignore() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] libc [..] [FRESH] filetime [..] @@ -2595,7 +2590,7 @@ fn include_overrides_gitignore() { assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] libc [..] [FRESH] filetime [..] @@ -2664,7 +2659,7 @@ fn invalid_git_dependency_manifest() { assert_that( project.cargo("build"), - execs().with_stderr(&format!( + execs().with_status(101).with_stderr(&format!( "[UPDATING] git repository `{}`\n\ error: failed to load source for a dependency on `dep1`\n\ \n\ diff --git a/tests/testsuite/init.rs b/tests/testsuite/init.rs index bf90178bf49..7a0f6ed95b4 100644 --- a/tests/testsuite/init.rs +++ b/tests/testsuite/init.rs @@ -18,7 +18,6 @@ fn simple_lib() { assert_that( cargo_process("init --lib --vcs none").env("USER", "foo"), execs() - .with_status(0) .with_stderr("[CREATED] library project"), ); @@ -26,7 +25,7 @@ fn simple_lib() { assert_that(&paths::root().join("src/lib.rs"), existing_file()); assert_that(&paths::root().join(".gitignore"), is_not(existing_file())); - assert_that(cargo_process("build"), execs().with_status(0)); + assert_that(cargo_process("build"), execs()); } #[test] @@ -36,14 +35,13 @@ fn simple_bin() { assert_that( cargo_process("init --bin --vcs none").env("USER", "foo").cwd(&path), execs() - .with_status(0) .with_stderr("[CREATED] binary (application) project"), ); assert_that(&paths::root().join("foo/Cargo.toml"), existing_file()); assert_that(&paths::root().join("foo/src/main.rs"), existing_file()); - assert_that(cargo_process("build").cwd(&path), execs().with_status(0)); + assert_that(cargo_process("build").cwd(&path), execs()); assert_that( &paths::root().join(&format!("foo/target/debug/foo{}", env::consts::EXE_SUFFIX)), existing_file(), @@ -80,12 +78,12 @@ fn bin_already_exists(explicit: bool, rellocation: &str) { if explicit { assert_that( cargo_process("init --bin --vcs none").env("USER", "foo").cwd(&path), - execs().with_status(0), + execs(), ); } else { assert_that( cargo_process("init --vcs none").env("USER", "foo").cwd(&path), - execs().with_status(0), + execs(), ); } @@ -220,7 +218,7 @@ fn lib_already_exists(rellocation: &str) { assert_that( cargo_process("init --vcs none").env("USER", "foo").cwd(&path), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("foo/Cargo.toml"), existing_file()); @@ -252,7 +250,7 @@ fn lib_already_exists_nosrc() { fn simple_git() { assert_that( cargo_process("init --lib --vcs git").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("Cargo.toml"), existing_file()); @@ -265,7 +263,7 @@ fn simple_git() { fn auto_git() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("Cargo.toml"), existing_file()); @@ -314,7 +312,7 @@ fn git_autodetect() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("Cargo.toml"), existing_file()); @@ -329,7 +327,7 @@ fn mercurial_autodetect() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("Cargo.toml"), existing_file()); @@ -349,7 +347,7 @@ fn gitignore_appended_not_replaced() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("Cargo.toml"), existing_file()); @@ -376,7 +374,7 @@ fn gitignore_added_newline_in_existing() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".gitignore"), existing_file()); @@ -395,7 +393,7 @@ fn gitignore_no_newline_in_new() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".gitignore"), existing_file()); @@ -419,7 +417,7 @@ fn mercurial_added_newline_in_existing() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".hgignore"), existing_file()); @@ -438,7 +436,7 @@ fn mercurial_no_newline_in_new() { assert_that( cargo_process("init --lib").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".hgignore"), existing_file()); @@ -457,7 +455,7 @@ fn cargo_lock_gitignored_if_lib1() { assert_that( cargo_process("init --lib --vcs git").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".gitignore"), existing_file()); @@ -481,7 +479,7 @@ fn cargo_lock_gitignored_if_lib2() { assert_that( cargo_process("init --vcs git").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".gitignore"), existing_file()); @@ -500,7 +498,7 @@ fn cargo_lock_not_gitignored_if_bin1() { assert_that( cargo_process("init --vcs git --bin").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".gitignore"), existing_file()); @@ -524,7 +522,7 @@ fn cargo_lock_not_gitignored_if_bin2() { assert_that( cargo_process("init --vcs git").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join(".gitignore"), existing_file()); @@ -541,7 +539,7 @@ fn cargo_lock_not_gitignored_if_bin2() { fn with_argument() { assert_that( cargo_process("init foo --vcs none").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("foo/Cargo.toml"), existing_file()); } diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index 209e6efbc19..db287f14985 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -25,7 +25,7 @@ fn simple() { assert_that( cargo_process("install foo"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] foo v0.0.1 (registry [..]) @@ -42,7 +42,7 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina assert_that( cargo_process("uninstall foo"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "[REMOVING] {home}[..]bin[..]foo[..]", home = cargo_home().display() )), @@ -83,7 +83,7 @@ error: some crates failed to install assert_that( cargo_process("uninstall foo bar"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [REMOVING] {home}[..]bin[..]foo[..] [REMOVING] {home}[..]bin[..]bar[..] @@ -107,7 +107,7 @@ fn pick_max_version() { assert_that( cargo_process("install foo"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] foo v0.2.1 (registry [..]) @@ -132,7 +132,7 @@ fn installs_beta_version_by_explicit_name_from_git() { assert_that( cargo_process("install --git").arg(p.url().to_string()).arg("foo"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -211,7 +211,7 @@ fn install_location_precedence() { assert_that( cargo_process("install foo --root").arg(&t1).env("CARGO_INSTALL_ROOT", &t2), - execs().with_status(0), + execs(), ); assert_that(&t1, has_installed_exe("foo")); assert_that(&t2, is_not(has_installed_exe("foo"))); @@ -220,14 +220,14 @@ fn install_location_precedence() { assert_that( cargo_process("install foo").env("CARGO_INSTALL_ROOT", &t2), - execs().with_status(0), + execs(), ); assert_that(&t2, has_installed_exe("foo")); assert_that(&t3, is_not(has_installed_exe("foo"))); println!("install install.root"); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); assert_that(&t3, has_installed_exe("foo")); assert_that(&t4, is_not(has_installed_exe("foo"))); @@ -235,7 +235,7 @@ fn install_location_precedence() { println!("install cargo home"); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); assert_that(&t4, has_installed_exe("foo")); } @@ -247,7 +247,7 @@ fn install_path() { assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); assert_that( @@ -293,14 +293,14 @@ fn multiple_crates_select() { assert_that( cargo_process("install --git").arg(p.url().to_string()).arg("foo"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_home(), is_not(has_installed_exe("bar"))); assert_that( cargo_process("install --git").arg(p.url().to_string()).arg("bar"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("bar")); } @@ -327,7 +327,7 @@ fn multiple_crates_auto_binaries() { assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -362,7 +362,7 @@ fn multiple_crates_auto_examples() { assert_that( cargo_process("install --path").arg(p.root()).arg("--example=foo"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -422,7 +422,7 @@ fn examples() { assert_that( cargo_process("install --path").arg(p.root()).arg("--example=foo"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -436,7 +436,7 @@ fn install_twice() { assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0), + execs(), ); assert_that( cargo_process("install --path").arg(p.root()), @@ -459,7 +459,7 @@ fn install_force() { assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0), + execs(), ); let p = project().at("foo2") @@ -469,7 +469,7 @@ fn install_force() { assert_that( cargo_process("install --force --path").arg(p.root()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [INSTALLING] foo v0.2.0 ([..]) [COMPILING] foo v0.2.0 ([..]) @@ -483,7 +483,7 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina assert_that( cargo_process("install --list"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ foo v0.2.0 ([..]): foo[..] @@ -501,7 +501,7 @@ fn install_force_partial_overlap() { assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0), + execs(), ); let p = project().at("foo2") @@ -512,7 +512,7 @@ fn install_force_partial_overlap() { assert_that( cargo_process("install --force --path").arg(p.root()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [INSTALLING] foo v0.2.0 ([..]) [COMPILING] foo v0.2.0 ([..]) @@ -527,7 +527,7 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina assert_that( cargo_process("install --list"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ foo v0.0.1 ([..]): foo-bin1[..] @@ -548,7 +548,7 @@ fn install_force_bin() { assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0), + execs(), ); let p = project().at("foo2") @@ -559,7 +559,7 @@ fn install_force_bin() { assert_that( cargo_process("install --force --bin foo-bin2 --path").arg(p.root()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [INSTALLING] foo v0.2.0 ([..]) [COMPILING] foo v0.2.0 ([..]) @@ -573,7 +573,7 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina assert_that( cargo_process("install --list"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ foo v0.0.1 ([..]): foo-bin1[..] @@ -616,7 +616,7 @@ fn git_repo() { // use `--locked` to test that we don't even try to write a lockfile assert_that( cargo_process("install --locked --git").arg(p.url().to_string()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] git repository `[..]` [INSTALLING] foo v0.1.0 ([..]) @@ -640,17 +640,17 @@ fn list() { assert_that( cargo_process("install --list"), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); assert_that( cargo_process("install bar --vers =0.2.1"), - execs().with_status(0), + execs(), ); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); assert_that( cargo_process("install --list"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ bar v0.2.1: bar[..] @@ -664,10 +664,10 @@ foo v0.0.1: #[test] fn list_error() { pkg("foo", "0.0.1"); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); assert_that( cargo_process("install --list"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ foo v0.0.1: foo[..] @@ -712,7 +712,7 @@ fn uninstall_pkg_does_not_exist() { fn uninstall_bin_does_not_exist() { pkg("foo", "0.0.1"); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); assert_that( cargo_process("uninstall foo --bin=bar"), execs() @@ -730,14 +730,14 @@ fn uninstall_piecemeal() { assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_home(), has_installed_exe("bar")); assert_that( cargo_process("uninstall foo --bin=bar"), - execs().with_status(0).with_stderr("[REMOVING] [..]bar[..]"), + execs().with_stderr("[REMOVING] [..]bar[..]"), ); assert_that(cargo_home(), has_installed_exe("foo")); @@ -745,7 +745,7 @@ fn uninstall_piecemeal() { assert_that( cargo_process("uninstall foo --bin=foo"), - execs().with_status(0).with_stderr("[REMOVING] [..]foo[..]"), + execs().with_stderr("[REMOVING] [..]foo[..]"), ); assert_that(cargo_home(), is_not(has_installed_exe("foo"))); @@ -764,15 +764,15 @@ fn subcommand_works_out_of_the_box() { .publish(); assert_that( cargo_process("install cargo-foo"), - execs().with_status(0), + execs(), ); assert_that( cargo_process("foo"), - execs().with_status(0).with_stdout("bar\n"), + execs().with_stdout("bar\n"), ); assert_that( cargo_process("--list"), - execs().with_status(0).with_stdout_contains(" foo\n"), + execs().with_stdout_contains(" foo\n"), ); } @@ -784,7 +784,7 @@ fn installs_from_cwd_by_default() { assert_that( cargo_process("install").cwd(p.root()), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ warning: To build the current package use `cargo build`, to install the current package run `cargo install --path .` ", @@ -835,10 +835,10 @@ fn do_not_rebuilds_on_local_install() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build --release"), execs().with_status(0)); + assert_that(p.cargo("build --release"), execs()); assert_that( cargo_process("install --path").arg(p.root()), - execs().with_status(0).with_stderr( + execs().with_stderr( "[INSTALLING] [..] [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [..] @@ -859,11 +859,11 @@ fn reports_unsuccessful_subcommand_result() { .publish(); assert_that( cargo_process("install cargo-fail"), - execs().with_status(0), + execs(), ); assert_that( cargo_process("--list"), - execs().with_status(0).with_stdout_contains(" fail\n"), + execs().with_stdout_contains(" fail\n"), ); assert_that( cargo_process("fail"), @@ -908,7 +908,7 @@ fn git_with_lockfile() { assert_that( cargo_process("install --git").arg(p.url().to_string()), - execs().with_status(0), + execs(), ); } @@ -920,7 +920,7 @@ fn q_silences_warnings() { assert_that( cargo_process("install -q --path").arg(p.root()), - execs().with_status(0).with_stderr(""), + execs().with_stderr(""), ); } @@ -937,7 +937,7 @@ fn readonly_dir() { assert_that( cargo_process("install foo").cwd(dir), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -974,9 +974,9 @@ fn use_path_workspace() { .file("baz/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let lock = p.read_lockfile(); - assert_that(p.cargo("install"), execs().with_status(0)); + assert_that(p.cargo("install"), execs()); let lock2 = p.read_lockfile(); assert_eq!(lock, lock2, "different lockfiles"); } @@ -1001,7 +1001,7 @@ fn dev_dependencies_no_check() { .build(); assert_that(p.cargo("build"), execs().with_status(101)); - assert_that(p.cargo("install"), execs().with_status(0)); + assert_that(p.cargo("install"), execs()); } #[test] @@ -1025,9 +1025,9 @@ fn dev_dependencies_lock_file_untouched() { .file("a/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let lock = p.read_lockfile(); - assert_that(p.cargo("install"), execs().with_status(0)); + assert_that(p.cargo("install"), execs()); let lock2 = p.read_lockfile(); assert!(lock == lock2, "different lockfiles"); } @@ -1039,7 +1039,7 @@ fn install_target_native() { assert_that( cargo_process("install foo --target").arg(support::rustc_host()), execs() - .with_status(0), + , ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -1055,7 +1055,7 @@ fn install_target_foreign() { assert_that( cargo_process("install foo --target").arg(cross_compile::alternate()), execs() - .with_status(0), + , ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -1067,9 +1067,7 @@ fn vers_precise() { assert_that( cargo_process("install foo --vers 0.1.1"), - execs() - .with_status(0) - .with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"), + execs().with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"), ); } @@ -1080,9 +1078,7 @@ fn version_too() { assert_that( cargo_process("install foo --version 0.1.1"), - execs() - .with_status(0) - .with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"), + execs().with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"), ); } @@ -1108,7 +1104,7 @@ fn legacy_version_requirement() { assert_that( cargo_process("install foo --vers 0.1"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ warning: the `--vers` provided, `0.1`, is not a valid semver version @@ -1135,7 +1131,7 @@ fn uninstall_multiple_and_specifying_bin() { fn uninstall_multiple_and_some_pkg_does_not_exist() { pkg("foo", "0.0.1"); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); assert_that( cargo_process("uninstall foo bar"), @@ -1163,7 +1159,7 @@ fn custom_target_dir_for_git_source() { assert_that( cargo_process("install --git").arg(p.url().to_string()), - execs().with_status(0), + execs(), ); assert_that( &paths::root().join("target/release"), @@ -1173,7 +1169,7 @@ fn custom_target_dir_for_git_source() { assert_that( cargo_process("install --force --git").arg(p.url().to_string()) .env("CARGO_TARGET_DIR", "target"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("target/release"), existing_dir()); } @@ -1206,7 +1202,7 @@ dependencies = [ ) .publish(); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); } #[test] @@ -1234,7 +1230,7 @@ dependencies = [ ) .publish(); - assert_that(cargo_process("install foo"), execs().with_status(0)); + assert_that(cargo_process("install foo"), execs()); } #[test] @@ -1258,7 +1254,7 @@ fn git_repo_replace() { let old_rev = repo.revparse_single("HEAD").unwrap().id(); assert_that( cargo_process("install --git").arg(p.url().to_string()), - execs().with_status(0), + execs(), ); git::commit(&repo); let new_rev = repo.revparse_single("HEAD").unwrap().id(); @@ -1273,7 +1269,7 @@ fn git_repo_replace() { ); assert_that( cargo_process("install --force --git").arg(p.url().to_string()), - execs().with_status(0), + execs(), ); assert!( fs::read_to_string(path) @@ -1305,10 +1301,10 @@ fn workspace_uses_workspace_target_dir() { .build(); assert_that(p.cargo("build --release").cwd(p.root().join("bar")), - execs().with_status(0)); + execs()); assert_that( cargo_process("install --path").arg(p.root().join("bar")), - execs().with_status(0).with_stderr( + execs().with_stderr( "[INSTALLING] [..] [FINISHED] release [optimized] target(s) in [..] [INSTALLING] [..] diff --git a/tests/testsuite/jobserver.rs b/tests/testsuite/jobserver.rs index ccf95111783..e2b4b42d770 100644 --- a/tests/testsuite/jobserver.rs +++ b/tests/testsuite/jobserver.rs @@ -50,7 +50,7 @@ fn jobserver_exists() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -162,7 +162,7 @@ all: .env("CARGO", cargo_exe()) .env("ADDR", addr.to_string()) .arg("-j2"), - execs().with_status(0), + execs(), ); child.join().unwrap(); } @@ -191,7 +191,7 @@ all: assert_that( p.process(make).env("CARGO", cargo_exe()).arg("-j2"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: a `-j` argument was passed to Cargo but Cargo is also configured \ with an external jobserver in its environment, ignoring the `-j` parameter diff --git a/tests/testsuite/local_registry.rs b/tests/testsuite/local_registry.rs index 2c7a0816f4e..917db217056 100644 --- a/tests/testsuite/local_registry.rs +++ b/tests/testsuite/local_registry.rs @@ -47,7 +47,7 @@ fn simple() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UNPACKING] bar v0.0.1 ([..]) [COMPILING] bar v0.0.1 @@ -59,9 +59,9 @@ fn simple() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } #[test] @@ -91,7 +91,7 @@ fn multiple_versions() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UNPACKING] bar v0.1.0 ([..]) [COMPILING] bar v0.1.0 @@ -110,7 +110,6 @@ fn multiple_versions() { assert_that( p.cargo("update").arg("-v"), execs() - .with_status(0) .with_stderr("[UPDATING] bar v0.1.0 -> v0.2.0"), ); } @@ -156,7 +155,7 @@ fn multiple_names() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UNPACKING] [..] [UNPACKING] [..] @@ -212,7 +211,7 @@ fn interdependent() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UNPACKING] [..] [UNPACKING] [..] @@ -282,7 +281,7 @@ fn path_dep_rewritten() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UNPACKING] [..] [UNPACKING] [..] @@ -373,7 +372,7 @@ fn different_directory_replacing_the_registry_is_bad() { // Generate a lock file against the crates.io registry Package::new("bar", "0.0.1").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // Switch back to our directory source, and now that we're replacing // crates.io make sure that this fails because we're replacing with a @@ -441,7 +440,7 @@ fn crates_io_registry_url_is_optional() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UNPACKING] bar v0.0.1 ([..]) [COMPILING] bar v0.0.1 @@ -453,7 +452,7 @@ fn crates_io_registry_url_is_optional() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } diff --git a/tests/testsuite/lockfile_compat.rs b/tests/testsuite/lockfile_compat.rs index d1e82e5b99e..5a65f7cf3fa 100644 --- a/tests/testsuite/lockfile_compat.rs +++ b/tests/testsuite/lockfile_compat.rs @@ -60,7 +60,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" .file("Cargo.lock", old_lockfile) .build(); - assert_that(p.cargo(cargo_command), execs().with_status(0)); + assert_that(p.cargo(cargo_command), execs()); let lock = p.read_lockfile(); for (l, r) in expected_lockfile.lines().zip(lock.lines()) { @@ -110,7 +110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" .file("Cargo.lock", &old_lockfile) .build(); - assert_that(p.cargo("build").arg("--locked"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--locked"), execs()); let lock = p.read_lockfile(); for (l, r) in old_lockfile.lines().zip(lock.lines()) { @@ -161,7 +161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let lock = p.read_lockfile(); assert!( @@ -400,7 +400,7 @@ fn current_lockfile_format() { .file("src/lib.rs", ""); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let actual = p.read_lockfile(); @@ -462,7 +462,7 @@ dependencies = [ let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let lock = p.read_lockfile(); assert!(lock.starts_with(lockfile.trim())); diff --git a/tests/testsuite/login.rs b/tests/testsuite/login.rs index 5292650edc4..062929a9d50 100644 --- a/tests/testsuite/login.rs +++ b/tests/testsuite/login.rs @@ -79,7 +79,7 @@ fn login_with_old_credentials() { assert_that( cargo_process("login --host").arg(registry().to_string()).arg(TOKEN), - execs().with_status(0), + execs(), ); let config = cargo_home().join("config"); @@ -102,7 +102,7 @@ fn login_with_new_credentials() { assert_that( cargo_process("login --host").arg(registry().to_string()).arg(TOKEN), - execs().with_status(0), + execs(), ); let config = cargo_home().join("config"); @@ -122,7 +122,7 @@ fn login_with_old_and_new_credentials() { fn login_without_credentials() { assert_that( cargo_process("login --host").arg(registry().to_string()).arg(TOKEN), - execs().with_status(0), + execs(), ); let config = cargo_home().join("config"); @@ -139,7 +139,7 @@ fn new_credentials_is_used_instead_old() { assert_that( cargo_process("login --host").arg(registry().to_string()).arg(TOKEN), - execs().with_status(0), + execs(), ); let config = Config::new(Shell::new(), cargo_home(), cargo_home()); @@ -158,7 +158,7 @@ fn registry_credentials() { assert_that( cargo_process("login --registry").arg(reg).arg(TOKEN).arg("-Zunstable-options") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); // Ensure that we have not updated the default token diff --git a/tests/testsuite/metadata.rs b/tests/testsuite/metadata.rs index 0f010914c7c..46134f4e40d 100644 --- a/tests/testsuite/metadata.rs +++ b/tests/testsuite/metadata.rs @@ -618,7 +618,7 @@ fn workspace_metadata() { assert_that( p.cargo("metadata"), - execs().with_status(0).with_json( + execs().with_json( r#" { "packages": [ @@ -725,7 +725,7 @@ fn workspace_metadata_no_deps() { assert_that( p.cargo("metadata").arg("--no-deps"), - execs().with_status(0).with_json( + execs().with_json( r#" { "packages": [ @@ -866,7 +866,7 @@ fn cargo_metadata_no_deps_path_to_cargo_toml_relative() { .arg("--manifest-path") .arg("foo/Cargo.toml") .cwd(p.root().parent().unwrap()), - execs().with_status(0).with_json(MANIFEST_OUTPUT), + execs().with_json(MANIFEST_OUTPUT), ); } @@ -883,7 +883,7 @@ fn cargo_metadata_no_deps_path_to_cargo_toml_absolute() { .arg("--manifest-path") .arg(p.root().join("Cargo.toml")) .cwd(p.root().parent().unwrap()), - execs().with_status(0).with_json(MANIFEST_OUTPUT), + execs().with_json(MANIFEST_OUTPUT), ); } @@ -936,7 +936,7 @@ fn cargo_metadata_no_deps_cwd() { assert_that( p.cargo("metadata").arg("--no-deps").cwd(p.root()), - execs().with_status(0).with_json(MANIFEST_OUTPUT), + execs().with_json(MANIFEST_OUTPUT), ); } @@ -983,7 +983,7 @@ fn multiple_features() { assert_that( p.cargo("metadata").arg("--features").arg("a b"), - execs().with_status(0), + execs(), ); } @@ -1077,14 +1077,14 @@ fn cargo_metadata_path_to_cargo_toml_project() { .arg("--manifest-path") .arg(p.root().join("bar/Cargo.toml")) .cwd(p.root().parent().unwrap()), - execs().with_status(0) + execs() ); assert_that( p.cargo("metadata") .arg("--manifest-path") .arg(p.root().join("target/package/bar-0.5.0/Cargo.toml")), - execs().with_status(0).with_json( + execs().with_json( r#" { "packages": [ @@ -1164,7 +1164,7 @@ fn package_edition_2018() { .build(); assert_that( p.cargo("metadata").masquerade_as_nightly_cargo(), - execs().with_status(0).with_json( + execs().with_json( r#" { "packages": [ @@ -1248,7 +1248,7 @@ fn target_edition_2018() { .build(); assert_that( p.cargo("metadata").masquerade_as_nightly_cargo(), - execs().with_status(0).with_json( + execs().with_json( r#" { "packages": [ diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index c91b4731c97..afa04343687 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -17,9 +17,7 @@ fn create_empty_gitconfig() { fn simple_lib() { assert_that( cargo_process("new --lib foo --vcs none").env("USER", "foo"), - execs() - .with_status(0) - .with_stderr("[CREATED] library `foo` project"), + execs().with_stderr("[CREATED] library `foo` project"), ); assert_that(&paths::root().join("foo"), existing_dir()); @@ -50,7 +48,7 @@ mod tests { assert_that( cargo_process("build").cwd(&paths::root().join("foo")), - execs().with_status(0), + execs(), ); } @@ -58,9 +56,7 @@ mod tests { fn simple_bin() { assert_that( cargo_process("new --bin foo").env("USER", "foo"), - execs() - .with_status(0) - .with_stderr("[CREATED] binary (application) `foo` project"), + execs().with_stderr("[CREATED] binary (application) `foo` project"), ); assert_that(&paths::root().join("foo"), existing_dir()); @@ -69,7 +65,7 @@ fn simple_bin() { assert_that( cargo_process("build").cwd(&paths::root().join("foo")), - execs().with_status(0), + execs(), ); assert_that( &paths::root().join(&format!("foo/target/debug/foo{}", env::consts::EXE_SUFFIX)), @@ -91,7 +87,7 @@ fn both_lib_and_bin() { fn simple_git() { assert_that( cargo_process("new --lib foo").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root(), existing_dir()); @@ -102,7 +98,7 @@ fn simple_git() { assert_that( cargo_process("build").cwd(&paths::root().join("foo")), - execs().with_status(0), + execs(), ); } @@ -186,7 +182,7 @@ fn finds_author_user() { create_empty_gitconfig(); assert_that( cargo_process("new foo").env("USER", "foo"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -203,7 +199,7 @@ fn finds_author_user_escaped() { create_empty_gitconfig(); assert_that( cargo_process("new foo").env("USER", "foo \"bar\""), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -220,7 +216,7 @@ fn finds_author_username() { create_empty_gitconfig(); assert_that( cargo_process("new foo").env_remove("USER").env("USERNAME", "foo"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -240,7 +236,7 @@ fn finds_author_priority() { .env("EMAIL", "baz2") .env("CARGO_NAME", "bar") .env("CARGO_EMAIL", "baz"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -259,7 +255,7 @@ fn finds_author_email() { cargo_process("new foo") .env("USER", "bar") .env("EMAIL", "baz"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -277,7 +273,7 @@ fn finds_author_git() { git_process("config --global user.email baz").exec().unwrap(); assert_that( cargo_process("new foo").env("USER", "foo"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -300,7 +296,7 @@ fn finds_local_author_git() { git_process("config user.email baz").exec().unwrap(); assert_that( cargo_process("init").env("USER", "foo"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("Cargo.toml"); @@ -318,7 +314,7 @@ fn finds_git_email() { cargo_process("new foo") .env("GIT_AUTHOR_NAME", "foo") .env("GIT_AUTHOR_EMAIL", "gitfoo"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -337,7 +333,7 @@ fn finds_git_author() { cargo_process("new foo") .env_remove("USER") .env("GIT_COMMITTER_NAME", "gitfoo"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -369,7 +365,7 @@ fn author_prefers_cargo() { assert_that( cargo_process("new foo").env("USER", "foo"), - execs().with_status(0), + execs(), ); let toml = paths::root().join("foo/Cargo.toml"); @@ -400,7 +396,7 @@ fn git_prefers_command_line() { assert_that( cargo_process("new foo --vcs git").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert!(paths::root().join("foo/.gitignore").exists()); } @@ -409,7 +405,7 @@ fn git_prefers_command_line() { fn subpackage_no_git() { assert_that( cargo_process("new foo").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that(&paths::root().join("foo/.git"), existing_dir()); @@ -419,7 +415,7 @@ fn subpackage_no_git() { fs::create_dir(&subpackage).unwrap(); assert_that( cargo_process("new foo/components/subcomponent").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that( @@ -436,7 +432,7 @@ fn subpackage_no_git() { fn subpackage_git_with_gitignore() { assert_that( cargo_process("new foo").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that( @@ -455,7 +451,7 @@ fn subpackage_git_with_gitignore() { fs::create_dir(&subpackage).unwrap(); assert_that( cargo_process("new foo/components/subcomponent").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that( @@ -473,14 +469,14 @@ fn subpackage_git_with_gitignore() { fn subpackage_git_with_vcs_arg() { assert_that( cargo_process("new foo").env("USER", "foo"), - execs().with_status(0), + execs(), ); let subpackage = paths::root().join("foo").join("components"); fs::create_dir(&subpackage).unwrap(); assert_that( cargo_process("new foo/components/subcomponent --vcs git").env("USER", "foo"), - execs().with_status(0), + execs(), ); assert_that( @@ -517,8 +513,6 @@ fn explicit_invalid_name_not_suggested() { fn explicit_project_name() { assert_that( cargo_process("new --lib foo --name bar").env("USER", "foo"), - execs() - .with_status(0) - .with_stderr("[CREATED] library `bar` project"), + execs().with_stderr("[CREATED] library `bar` project"), ); } diff --git a/tests/testsuite/out_dir.rs b/tests/testsuite/out_dir.rs index 970083f2492..47a14be3b31 100644 --- a/tests/testsuite/out_dir.rs +++ b/tests/testsuite/out_dir.rs @@ -16,7 +16,7 @@ fn binary_with_debug() { assert_that( p.cargo("build -Z unstable-options --out-dir out") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); check_dir_contents( &p.root().join("out"), @@ -53,7 +53,7 @@ fn static_library_with_debug() { assert_that( p.cargo("build -Z unstable-options --out-dir out") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); check_dir_contents( &p.root().join("out"), @@ -90,7 +90,7 @@ fn dynamic_library_with_debug() { assert_that( p.cargo("build -Z unstable-options --out-dir out") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); check_dir_contents( &p.root().join("out"), @@ -126,7 +126,7 @@ fn rlib_with_debug() { assert_that( p.cargo("build -Z unstable-options --out-dir out") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); check_dir_contents( &p.root().join("out"), @@ -171,7 +171,7 @@ fn include_only_the_binary_from_the_current_package() { assert_that( p.cargo("build -Z unstable-options --bin foo --out-dir out") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); check_dir_contents( &p.root().join("out"), @@ -206,7 +206,7 @@ fn replaces_artifacts() { assert_that( p.cargo("build -Z unstable-options --out-dir out") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); assert_that( process(&p.root() @@ -220,7 +220,7 @@ fn replaces_artifacts() { assert_that( p.cargo("build -Z unstable-options --out-dir out") .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); assert_that( process(&p.root() diff --git a/tests/testsuite/overrides.rs b/tests/testsuite/overrides.rs index 944a29bbed4..580a31be588 100644 --- a/tests/testsuite/overrides.rs +++ b/tests/testsuite/overrides.rs @@ -37,7 +37,7 @@ fn override_simple() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [UPDATING] git repository `[..]` @@ -191,7 +191,7 @@ fn transitive() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [UPDATING] git repository `[..]` @@ -204,7 +204,7 @@ fn transitive() { ), ); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -240,7 +240,7 @@ fn persists_across_rebuilds() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [UPDATING] git repository `file://[..]` @@ -251,7 +251,7 @@ fn persists_across_rebuilds() { ), ); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -284,7 +284,7 @@ fn replace_registry_with_path() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [COMPILING] bar v0.1.0 (file://[..]) @@ -347,7 +347,7 @@ fn use_a_spec_to_select() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [UPDATING] git repository `[..]` @@ -408,7 +408,7 @@ fn override_adds_some_deps() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [UPDATING] git repository `[..]` @@ -421,14 +421,14 @@ fn override_adds_some_deps() { ), ); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); Package::new("baz", "0.1.2").publish(); assert_that( p.cargo("update") .arg("-p") .arg(&format!("{}#bar", foo.url())), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `file://[..]` [UPDATING] registry `file://[..]` @@ -439,14 +439,14 @@ fn override_adds_some_deps() { p.cargo("update") .arg("-p") .arg("https://github.com/rust-lang/crates.io-index#bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` ", ), ); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -495,10 +495,10 @@ fn locked_means_locked_yes_no_seriously_i_mean_locked() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -751,10 +751,10 @@ fn update() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); assert_that( p.cargo("update"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] git repository `[..]` @@ -807,7 +807,7 @@ fn no_override_self() { .file("src/lib.rs", "#![no_std] pub extern crate near;") .build(); - assert_that(p.cargo("build").arg("--verbose"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--verbose"), execs()); } #[test] @@ -860,7 +860,7 @@ fn broken_path_override_warns() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] [..] warning: path override for crate `a` has altered the original list of @@ -995,7 +995,7 @@ fn override_an_override() { .file("serde/src/lib.rs", "pub fn serde08_override() {}") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -1044,11 +1044,10 @@ fn overriding_nonexistent_no_spurious() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr( "\ [WARNING] package replacement is not used: [..]baz:0.1.0 @@ -1094,7 +1093,7 @@ fn no_warnings_when_replace_is_used_in_another_workspace_member() { assert_that( p.cargo("build").cwd(p.root().join("first_crate")), - execs().with_status(0).with_stdout("").with_stderr( + execs().with_stdout("").with_stderr( "\ [UPDATING] registry `[..]` [COMPILING] bar v0.1.0 ([..]) @@ -1105,7 +1104,7 @@ fn no_warnings_when_replace_is_used_in_another_workspace_member() { assert_that( p.cargo("build").cwd(p.root().join("second_crate")), - execs().with_status(0).with_stdout("").with_stderr( + execs().with_stdout("").with_stderr( "\ [COMPILING] second_crate v0.1.0 ([..]) [FINISHED] [..]", @@ -1150,7 +1149,7 @@ fn override_to_path_dep() { .file(".cargo/config", r#"paths = ["bar"]"#) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1192,7 +1191,7 @@ fn replace_to_path_dep() { .file("bar/baz/src/lib.rs", "pub fn baz() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1244,7 +1243,7 @@ fn paths_ok_with_optional() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.1.0 ([..]bar2) [COMPILING] foo v0.0.1 ([..]) @@ -1292,7 +1291,7 @@ fn paths_add_optional_bad() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ warning: path override for crate `bar` has altered the original list of dependencies; the dependency on `baz` was either added or\ @@ -1360,7 +1359,7 @@ fn override_with_default_feature() { .file("another2/src/lib.rs", "") .build(); - assert_that(p.cargo("run"), execs().with_status(0)); + assert_that(p.cargo("run"), execs()); } #[test] diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index 0e2c1d75ace..d4ed25415f2 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; use git2; use support::{cargo_process, sleep_ms, ChannelChanger}; -use support::{basic_manifest, execs, git, paths, project, registry, path2url}; +use support::{basic_manifest, execs, git, is_nightly, paths, project, registry, path2url}; use support::registry::Package; use flate2::read::GzDecoder; use support::hamcrest::{assert_that, contains, existing_file}; @@ -29,7 +29,7 @@ fn simple() { assert_that( p.cargo("package"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [WARNING] manifest has no documentation[..] See [..] @@ -47,14 +47,14 @@ See [..] ); assert_that( p.cargo("package").arg("-l"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ Cargo.toml src/main.rs ", ), ); - assert_that(p.cargo("package"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("package"), execs().with_stdout("")); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); let mut rdr = GzDecoder::new(f); @@ -81,7 +81,7 @@ fn metadata_warning() { .build(); assert_that( p.cargo("package"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ warning: manifest has no description, license, license-file, documentation, \ homepage or repository. @@ -110,7 +110,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info. .build(); assert_that( p.cargo("package"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ warning: manifest has no description, documentation, homepage or repository. See http://doc.crates.io/manifest.html#package-metadata for more info. @@ -140,7 +140,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info. .build(); assert_that( p.cargo("package"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [PACKAGING] foo v0.0.1 ({dir}) [VERIFYING] foo v0.0.1 ({dir}) @@ -161,12 +161,12 @@ fn package_verbose() { .file("a/Cargo.toml", &basic_manifest("a", "0.0.1")) .file("a/src/lib.rs", "") .build(); - assert_that(cargo_process("build").cwd(p.root()), execs().with_status(0)); + assert_that(cargo_process("build").cwd(p.root()), execs()); println!("package main repo"); assert_that( cargo_process("package -v --no-verify").cwd(p.root()), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [WARNING] manifest has no description[..] See http://doc.crates.io/manifest.html#package-metadata for more info. @@ -180,7 +180,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info. println!("package sub-repo"); assert_that( cargo_process("package -v --no-verify").cwd(p.root().join("a")), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [WARNING] manifest has no description[..] See http://doc.crates.io/manifest.html#package-metadata for more info. @@ -197,10 +197,10 @@ fn package_verification() { let p = project() .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("package"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [WARNING] manifest has no description[..] See http://doc.crates.io/manifest.html#package-metadata for more info. @@ -316,7 +316,7 @@ fn exclude() { assert_that( p.cargo("package").arg("--no-verify").arg("-v"), - execs().with_status(0).with_stdout("").with_stderr( + execs().with_stdout("").with_stderr( "\ [WARNING] manifest has no description[..] See http://doc.crates.io/manifest.html#package-metadata for more info. @@ -362,7 +362,7 @@ See [..] assert_that( p.cargo("package").arg("-l"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ Cargo.toml dir_root_1/some_dir/file @@ -405,7 +405,7 @@ fn include() { assert_that( p.cargo("package").arg("--no-verify").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [WARNING] manifest has no description[..] See http://doc.crates.io/manifest.html#package-metadata for more info. @@ -425,7 +425,7 @@ fn package_lib_with_bin() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("package").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("package").arg("-v"), execs()); } #[test] @@ -464,9 +464,7 @@ fn package_git_submodule() { assert_that( cargo_process("package --no-verify -v").cwd(project.root()), - execs() - .with_status(0) - .with_stderr_contains("[ARCHIVING] bar/Makefile"), + execs().with_stderr_contains("[ARCHIVING] bar/Makefile"), ); } @@ -481,10 +479,10 @@ fn no_duplicates_from_modified_tracked_files() { .unwrap() .write_all(br#"fn main() { println!("A change!"); }"#) .unwrap(); - assert_that(cargo_process("build").cwd(p.root()), execs().with_status(0)); + assert_that(cargo_process("build").cwd(p.root()), execs()); assert_that( cargo_process("package --list").cwd(p.root()), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ Cargo.toml src/main.rs @@ -517,7 +515,7 @@ fn ignore_nested() { assert_that( p.cargo("package"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [WARNING] manifest has no documentation[..] See http://doc.crates.io/manifest.html#package-metadata for more info. @@ -535,14 +533,14 @@ See http://doc.crates.io/manifest.html#package-metadata for more info. ); assert_that( p.cargo("package").arg("-l"), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ Cargo.toml src[..]main.rs ", ), ); - assert_that(p.cargo("package"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("package"), execs().with_stdout("")); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); let mut rdr = GzDecoder::new(f); @@ -592,7 +590,7 @@ fn repackage_on_source_change() { .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - assert_that(p.cargo("package"), execs().with_status(0)); + assert_that(p.cargo("package"), execs()); // Add another source file let mut file = File::create(p.root().join("src").join("foo.rs")).unwrap_or_else(|e| { @@ -609,7 +607,7 @@ fn repackage_on_source_change() { // Check that cargo rebuilds the tarball assert_that( cargo_process("package").cwd(p.root()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [WARNING] [..] See [..] @@ -772,7 +770,7 @@ fn generated_manifest() { p.cargo("package") .masquerade_as_nightly_cargo() .arg("--no-verify"), - execs().with_status(0), + execs(), ); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); @@ -870,7 +868,7 @@ fn ignore_workspace_specifier() { p.cargo("package") .arg("--no-verify") .cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); let f = File::open(&p.root().join("target/package/bar-0.1.0.crate")).unwrap(); @@ -930,12 +928,15 @@ fn package_two_kinds_of_deps() { assert_that( p.cargo("package").arg("--no-verify"), - execs().with_status(0), + execs(), ); } #[test] fn test_edition() { + if !is_nightly() { // --edition is nightly-only + return; + } let p = project() .file( "Cargo.toml", @@ -1083,7 +1084,7 @@ fn package_lockfile() { assert_that( p.cargo("package").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [WARNING] manifest has no documentation[..] See [..] @@ -1101,7 +1102,7 @@ See [..] ); assert_that( p.cargo("package").arg("-l").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ Cargo.lock Cargo.toml @@ -1111,7 +1112,7 @@ src/main.rs ); assert_that( p.cargo("package").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); @@ -1159,7 +1160,7 @@ fn package_lockfile_git_repo() { .build(); assert_that( p.cargo("package").arg("-l").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stdout( + execs().with_stdout( "\ Cargo.lock Cargo.toml @@ -1191,7 +1192,7 @@ fn no_lock_file_with_library() { assert_that( p.cargo("package").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); @@ -1237,7 +1238,7 @@ fn lock_file_and_workspace() { p.cargo("package") .cwd(p.root().join("foo")) .masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); @@ -1291,6 +1292,6 @@ To proceed despite this, pass the `--no-verify` flag.", assert_that( p.cargo("package --no-verify"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/patch.rs b/tests/testsuite/patch.rs index 2de96f86e41..cf815afc305 100644 --- a/tests/testsuite/patch.rs +++ b/tests/testsuite/patch.rs @@ -50,7 +50,7 @@ fn replace() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [DOWNLOADING] baz v0.1.0 ([..]) @@ -64,7 +64,7 @@ fn replace() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -95,7 +95,7 @@ fn nonexistent() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [COMPILING] bar v0.1.0 (file://[..]) @@ -106,7 +106,7 @@ fn nonexistent() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -143,7 +143,7 @@ fn patch_git() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `file://[..]` [COMPILING] bar v0.1.0 (file://[..]) @@ -154,7 +154,7 @@ fn patch_git() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -191,7 +191,7 @@ fn patch_to_git() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `file://[..]` [UPDATING] registry `file://[..]` @@ -203,7 +203,7 @@ fn patch_to_git() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -234,7 +234,7 @@ fn unused() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [DOWNLOADING] bar v0.1.0 [..] @@ -246,7 +246,7 @@ fn unused() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); // unused patch should be in the lock file @@ -297,7 +297,7 @@ fn unused_git() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] git repository `file://[..]` [UPDATING] registry `file://[..]` @@ -310,7 +310,7 @@ fn unused_git() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -338,7 +338,7 @@ fn add_patch() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [DOWNLOADING] bar v0.1.0 [..] @@ -350,7 +350,7 @@ fn add_patch() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); t!(t!(File::create(p.root().join("Cargo.toml"))).write_all( @@ -370,7 +370,7 @@ fn add_patch() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.1.0 (file://[..]) [COMPILING] foo v0.0.1 (file://[..]) @@ -380,7 +380,7 @@ fn add_patch() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -408,7 +408,7 @@ fn add_ignored_patch() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [DOWNLOADING] bar v0.1.0 [..] @@ -420,7 +420,7 @@ fn add_ignored_patch() { ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); t!(t!(File::create(p.root().join("Cargo.toml"))).write_all( @@ -441,12 +441,11 @@ fn add_ignored_patch() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -477,7 +476,7 @@ fn new_minor() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [COMPILING] bar v0.1.1 [..] @@ -528,7 +527,7 @@ fn transitive_new_minor() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [COMPILING] baz v0.1.1 [..] @@ -567,7 +566,7 @@ fn new_major() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [COMPILING] bar v0.2.0 [..] @@ -578,11 +577,10 @@ fn new_major() { ); Package::new("bar", "0.2.0").publish(); - assert_that(p.cargo("update"), execs().with_status(0)); + assert_that(p.cargo("update"), execs()); assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); @@ -599,7 +597,7 @@ fn new_major() { )); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [DOWNLOADING] bar v0.2.0 [..] @@ -651,7 +649,7 @@ fn transitive_new_major() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `file://[..]` [COMPILING] baz v0.2.0 [..] @@ -693,7 +691,7 @@ fn remove_patch() { .build(); // Generate a lock file where `foo` is unused - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let mut lock_file1 = String::new(); File::open(p.root().join("Cargo.lock")) .unwrap() @@ -718,7 +716,7 @@ fn remove_patch() { "#.as_bytes(), ) .unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let mut lock_file2 = String::new(); File::open(p.root().join("Cargo.lock")) .unwrap() @@ -727,7 +725,7 @@ fn remove_patch() { // Remove the lock file and build from scratch fs::remove_file(p.root().join("Cargo.lock")).unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let mut lock_file3 = String::new(); File::open(p.root().join("Cargo.lock")) .unwrap() @@ -843,10 +841,10 @@ fn patch_in_virtual() { .file("foo/src/lib.rs", r#""#) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -897,12 +895,12 @@ fn patch_depends_on_another_patch() { .file("baz/src/lib.rs", r#""#) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // Nothing should be rebuilt, no registry should be updated. assert_that( p.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } @@ -946,5 +944,5 @@ fn replace_prerelease() { .file("baz/src/lib.rs", "pub fn baz() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } diff --git a/tests/testsuite/path.rs b/tests/testsuite/path.rs index f2163948600..34fab8ef241 100644 --- a/tests/testsuite/path.rs +++ b/tests/testsuite/path.rs @@ -71,7 +71,7 @@ fn cargo_compile_with_nested_deps_shorthand() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "[COMPILING] baz v0.5.0 ({}/bar/baz)\n\ [COMPILING] bar v0.5.0 ({}/bar)\n\ [COMPILING] foo v0.5.0 ({})\n\ @@ -87,18 +87,18 @@ fn cargo_compile_with_nested_deps_shorthand() { assert_that( process(&p.bin("foo")), - execs().with_stdout("test passed\n").with_status(0), + execs().with_stdout("test passed\n"), ); println!("cleaning"); assert_that( p.cargo("clean").arg("-v"), - execs().with_stdout("").with_status(0), + execs().with_stdout(""), ); println!("building baz"); assert_that( p.cargo("build").arg("-p").arg("baz"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "[COMPILING] baz v0.5.0 ({}/bar/baz)\n\ [FINISHED] dev [unoptimized + debuginfo] target(s) \ in [..]\n", @@ -108,7 +108,7 @@ fn cargo_compile_with_nested_deps_shorthand() { println!("building foo"); assert_that( p.cargo("build").arg("-p").arg("foo"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "[COMPILING] bar v0.5.0 ({}/bar)\n\ [COMPILING] foo v0.5.0 ({})\n\ [FINISHED] dev [unoptimized + debuginfo] target(s) \ @@ -603,7 +603,7 @@ fn override_relative() { ) .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -638,7 +638,7 @@ fn override_self() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -690,7 +690,7 @@ fn override_path_dep() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -810,7 +810,7 @@ fn dev_deps_no_rebuild_lib() { .build(); assert_that( p.cargo("build").env("FOO", "bar"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "[COMPILING] foo v0.5.0 ({})\n\ [FINISHED] dev [unoptimized + debuginfo] target(s) \ in [..]\n", @@ -821,7 +821,6 @@ fn dev_deps_no_rebuild_lib() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] [..] v0.5.0 ({url}[..]) @@ -868,7 +867,7 @@ fn custom_target_no_rebuild() { .build(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a v0.5.0 ([..]) [COMPILING] foo v0.5.0 ([..]) @@ -885,7 +884,7 @@ fn custom_target_no_rebuild() { p.cargo("build") .arg("--manifest-path=b/Cargo.toml") .env("CARGO_TARGET_DIR", "target_moved"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] b v0.5.0 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -929,7 +928,7 @@ fn override_and_depend() { .build(); assert_that( p.cargo("build").cwd(p.root().join("b")), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a2 v0.5.0 ([..]) [COMPILING] a1 v0.5.0 ([..]) @@ -1000,7 +999,7 @@ fn invalid_path_dep_in_workspace_with_lockfile() { .build(); // Generate a lock file - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // Change the dependency on `bar` to an invalid path File::create(&p.root().join("foo/Cargo.toml")) @@ -1055,7 +1054,7 @@ fn workspace_produces_rlib() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.root().join("target/debug/libtop.rlib"), existing_file()); assert_that( diff --git a/tests/testsuite/plugins.rs b/tests/testsuite/plugins.rs index b78e17a7394..33bb5937b98 100644 --- a/tests/testsuite/plugins.rs +++ b/tests/testsuite/plugins.rs @@ -98,8 +98,8 @@ fn plugin_to_the_max() { .file("src/lib.rs", "pub fn baz() -> i32 { 1 }") .build(); - assert_that(foo.cargo("build"), execs().with_status(0)); - assert_that(foo.cargo("doc"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); + assert_that(foo.cargo("doc"), execs()); } #[test] @@ -203,7 +203,7 @@ fn plugin_with_dynamic_native_dependency() { ) .build(); - assert_that(build.cargo("build"), execs().with_status(0)); + assert_that(build.cargo("build"), execs()); let src = workspace.root().join("target/debug"); let lib = fs::read_dir(&src) @@ -217,7 +217,7 @@ fn plugin_with_dynamic_native_dependency() { assert_that( foo.cargo("build").env("SRC", &lib).arg("-v"), - execs().with_status(0), + execs(), ); } @@ -244,7 +244,7 @@ fn plugin_integration() { .file("tests/it_works.rs", "") .build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } #[test] @@ -279,7 +279,7 @@ fn doctest_a_plugin() { .file("bar/src/lib.rs", "pub fn bar() {}") .build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } // See #1515 @@ -332,7 +332,7 @@ fn native_plugin_dependency_with_custom_ar_linker() { assert_that( bar.cargo("build").arg("--verbose"), - execs().with_stderr_contains( + execs().with_status(101).with_stderr_contains( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] -C ar=nonexistent-ar -C linker=nonexistent-linker [..]` @@ -386,7 +386,7 @@ fn panic_abort_plugins() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -440,5 +440,5 @@ fn shared_panic_abort_plugins() { .file("baz/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } diff --git a/tests/testsuite/proc_macro.rs b/tests/testsuite/proc_macro.rs index 650f0f42c8d..01e2c8ec4c8 100644 --- a/tests/testsuite/proc_macro.rs +++ b/tests/testsuite/proc_macro.rs @@ -57,7 +57,7 @@ fn probe_cfg_before_crate_type_discovery() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -115,8 +115,8 @@ fn noop() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("build"), execs()); } #[test] @@ -195,10 +195,10 @@ fn impl_and_derive() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("run"), - execs().with_status(0).with_stdout("X { success: true }"), + execs().with_stdout("X { success: true }"), ); } @@ -294,7 +294,6 @@ fn a() { assert_that( foo.cargo("test"), execs() - .with_status(0) .with_stdout_contains("test a ... ok") .with_stdout_contains_n("test [..] ... ok", 2), ); diff --git a/tests/testsuite/profile_config.rs b/tests/testsuite/profile_config.rs index 7bf2dedc4ce..393693fcfb6 100644 --- a/tests/testsuite/profile_config.rs +++ b/tests/testsuite/profile_config.rs @@ -19,7 +19,6 @@ fn profile_config_gated() { assert_that( p.cargo("build -v"), execs() - .with_status(0) .with_stderr_contains( "\ [WARNING] profiles in config files require `-Z config-profile` command-line option @@ -67,7 +66,7 @@ fn profile_config_validate_warnings() { assert_that( p.cargo("build -Z config-profile") .masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [WARNING] unused key `profile.asdf` in config file `[..].cargo/config` [WARNING] unused key `profile.test` in config file `[..].cargo/config` @@ -263,7 +262,7 @@ fn profile_config_all_options() { assert_that( p.cargo("build --release -v -Z config-profile") .masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo [..] [RUNNING] `rustc --crate-name foo [..] \ @@ -327,7 +326,7 @@ fn profile_config_override_precedence() { assert_that( p.cargo("build -v -Z config-profile") .masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar [..] -C opt-level=2 -C codegen-units=2 [..] @@ -365,7 +364,6 @@ fn profile_config_no_warn_unknown_override() { p.cargo("build -Z config-profile") .masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_does_not_contain("[..]warning[..]"), ); } @@ -395,7 +393,6 @@ fn profile_config_mixed_types() { p.cargo("build -v -Z config-profile") .masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_contains("[..]-C opt-level=3 [..]"), ); } diff --git a/tests/testsuite/profile_overrides.rs b/tests/testsuite/profile_overrides.rs index e54b29f130e..eb8ebb74cc6 100644 --- a/tests/testsuite/profile_overrides.rs +++ b/tests/testsuite/profile_overrides.rs @@ -95,7 +95,7 @@ fn profile_override_basic() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr( + execs().with_stderr( "[COMPILING] bar [..] [RUNNING] `rustc --crate-name bar [..] -C opt-level=3 [..]` [COMPILING] foo [..] @@ -137,7 +137,7 @@ fn profile_override_warnings() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] version or URL in profile override spec `bar:1.2.3` does not match any of the packages: bar v0.5.0 ([..]) [WARNING] profile override spec `bart` did not match any packages @@ -315,7 +315,7 @@ fn profile_override_hierarchy() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr_unordered("\ + execs().with_stderr_unordered("\ [COMPILING] m3 [..] [COMPILING] dep [..] [RUNNING] `rustc --crate-name m3 m3/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=4 [..] @@ -429,7 +429,6 @@ fn profile_override_spec() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr_contains( "[RUNNING] `rustc [..]dep1/src/lib.rs [..] -C codegen-units=1 [..]", ) diff --git a/tests/testsuite/profile_targets.rs b/tests/testsuite/profile_targets.rs index 7a2675e4e88..210a8ed4347 100644 --- a/tests/testsuite/profile_targets.rs +++ b/tests/testsuite/profile_targets.rs @@ -76,7 +76,7 @@ fn profile_selection_build() { // - bdep `panic` is not set because it thinks `build.rs` is a plugin. // - bar `panic` is not set because it is shared with `bdep`. // - build_script_build is built without panic because it thinks `build.rs` is a plugin. - assert_that(p.cargo("build -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("build -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] bdep [..] @@ -91,7 +91,7 @@ foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 ")); assert_that( p.cargo("build -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -108,7 +108,7 @@ fn profile_selection_build_release() { // Build default targets, release. assert_that(p.cargo("build --release -vv"), - execs().with_status(0).with_stderr_unordered("\ + execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] bdep [..] @@ -123,7 +123,7 @@ foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 ")); assert_that( p.cargo("build --release -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -174,7 +174,7 @@ fn profile_selection_build_all_targets() { // bin dev build // example dev build assert_that(p.cargo("build --all-targets -vv"), - execs().with_status(0).with_stderr_unordered("\ + execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] @@ -200,7 +200,7 @@ foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 ")); assert_that( p.cargo("build -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -248,7 +248,7 @@ fn profile_selection_build_all_targets_release() { // bin release build // example release build assert_that(p.cargo("build --all-targets --release -vv"), - execs().with_status(0).with_stderr_unordered("\ + execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] @@ -270,7 +270,7 @@ foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 ")); assert_that( p.cargo("build --all-targets --release -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -307,7 +307,7 @@ fn profile_selection_test() { // bin test test // bin dev build // - assert_that(p.cargo("test -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("test -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] @@ -333,7 +333,7 @@ foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 ")); assert_that( p.cargo("test -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -375,7 +375,7 @@ fn profile_selection_test_release() { // bin bench test // bin release build // - assert_that(p.cargo("test --release -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("test --release -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] @@ -401,7 +401,7 @@ foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 ")); assert_that( p.cargo("test --release -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -443,7 +443,7 @@ fn profile_selection_bench() { // bin bench test(bench) // bin release build // - assert_that(p.cargo("bench -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("bench -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] @@ -466,7 +466,7 @@ foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 ")); assert_that( p.cargo("bench -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -513,7 +513,7 @@ fn profile_selection_check_all_targets() { // bin dev check // bin dev-panic check-test (checking bin as a unittest) // - assert_that(p.cargo("check --all-targets -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("check --all-targets -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] @@ -541,7 +541,7 @@ foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 // https://github.com/rust-lang/cargo/issues/3624 assert_that( p.cargo("check --all-targets -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -565,7 +565,7 @@ fn profile_selection_check_all_targets_release() { // This is a pretty straightforward variant of // `profile_selection_check_all_targets` that uses `release` instead of // `dev` for all targets. - assert_that(p.cargo("check --all-targets --release -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("check --all-targets --release -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 [..] @@ -589,7 +589,7 @@ foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 assert_that( p.cargo("check --all-targets --release -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -632,7 +632,7 @@ fn profile_selection_check_all_targets_test() { // bench dev-panic check-test // bin dev-panic check-test // - assert_that(p.cargo("check --all-targets --profile=test -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("check --all-targets --profile=test -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] @@ -653,7 +653,7 @@ foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 assert_that( p.cargo("check --all-targets --profile=test -vv"), - execs().with_status(0).with_stderr_unordered( + execs().with_stderr_unordered( "\ [FRESH] bar [..] [FRESH] bdep [..] @@ -678,7 +678,7 @@ fn profile_selection_doc() { // foo custom dev* link For build.rs // // `*` = wants panic, but it is cleared when args are built. - assert_that(p.cargo("doc -vv"), execs().with_status(0).with_stderr_unordered("\ + assert_that(p.cargo("doc -vv"), execs().with_stderr_unordered("\ [COMPILING] bar [..] [DOCUMENTING] bar [..] [RUNNING] `rustc --crate-name bar bar/src/lib.rs --crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index efec6176cba..c536d56a28b 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -26,7 +26,7 @@ fn profile_overrides() { .build(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] test v0.0.0 ({url}) [RUNNING] `rustc --crate-name test src/lib.rs --crate-type lib \ @@ -65,7 +65,7 @@ fn opt_level_override_0() { .build(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] test v0.0.0 ({url}) [RUNNING] `rustc --crate-name test src/lib.rs --crate-type lib \ @@ -101,7 +101,7 @@ fn debug_override_1() { .build(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] test v0.0.0 ({url}) [RUNNING] `rustc --crate-name test src/lib.rs --crate-type lib \ @@ -140,7 +140,7 @@ fn check_opt_level_override(profile_level: &str, rustc_level: &str) { .build(); assert_that( p.cargo("build").arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] test v0.0.0 ({url}) [RUNNING] `rustc --crate-name test src/lib.rs --crate-type lib \ @@ -220,7 +220,7 @@ fn top_level_overrides_deps() { .build(); assert_that( p.cargo("build").arg("-v").arg("--release"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ({url}/foo) [RUNNING] `rustc --crate-name foo foo/src/lib.rs \ @@ -290,7 +290,7 @@ fn profile_in_non_root_manifest_triggers_a_warning() { assert_that( p.cargo("build").cwd(p.root().join("bar")).arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [WARNING] profiles for the non root package will be ignored, specify profiles at the workspace root: package: [..] @@ -332,7 +332,7 @@ fn profile_in_virtual_manifest_works() { assert_that( p.cargo("build").cwd(p.root().join("bar")).arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.1.0 ([..]) [RUNNING] `rustc [..]` @@ -363,7 +363,7 @@ fn profile_panic_test_bench() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [WARNING] `panic` setting is ignored for `test` profile [WARNING] `panic` setting is ignored for `bench` profile @@ -392,7 +392,6 @@ fn profile_doc_deprecated() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr_contains("[WARNING] profile `doc` is deprecated and has no effect"), ); } diff --git a/tests/testsuite/publish.rs b/tests/testsuite/publish.rs index f229bbd6d3e..f09643f6d37 100644 --- a/tests/testsuite/publish.rs +++ b/tests/testsuite/publish.rs @@ -34,7 +34,7 @@ fn simple() { .arg("--no-verify") .arg("--index") .arg(publish::registry().to_string()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [WARNING] manifest has no documentation, [..] @@ -110,7 +110,7 @@ fn old_token_location() { .arg("--no-verify") .arg("--index") .arg(publish::registry().to_string()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [WARNING] manifest has no documentation, [..] @@ -179,7 +179,7 @@ fn simple_with_host() { .arg("--no-verify") .arg("--host") .arg(publish::registry().to_string()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [WARNING] The flag '--host' is no longer valid. @@ -259,7 +259,7 @@ fn simple_with_index_and_host() { .arg(publish::registry().to_string()) .arg("--host") .arg(publish::registry().to_string()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [WARNING] The flag '--host' is no longer valid. @@ -492,7 +492,7 @@ fn publish_clean() { p.cargo("publish") .arg("--index") .arg(publish::registry().to_string()), - execs().with_status(0), + execs(), ); } @@ -525,7 +525,7 @@ fn publish_in_sub_repo() { .cwd(p.root().join("bar")) .arg("--index") .arg(publish::registry().to_string()), - execs().with_status(0), + execs(), ); } @@ -558,7 +558,7 @@ fn publish_when_ignored() { p.cargo("publish") .arg("--index") .arg(publish::registry().to_string()), - execs().with_status(0), + execs(), ); } @@ -590,7 +590,7 @@ fn ignore_when_crate_ignored() { .cwd(p.root().join("bar")) .arg("--index") .arg(publish::registry().to_string()), - execs().with_status(0), + execs(), ); } @@ -648,7 +648,7 @@ fn dry_run() { .arg("--dry-run") .arg("--index") .arg(publish::registry().to_string()), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [WARNING] manifest has no documentation, [..] @@ -820,7 +820,7 @@ fn publish_allowed_registry() { .arg("--registry") .arg("alternative") .arg("-Zunstable-options"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/read_manifest.rs b/tests/testsuite/read_manifest.rs index b5d0fd16889..71d112d471c 100644 --- a/tests/testsuite/read_manifest.rs +++ b/tests/testsuite/read_manifest.rs @@ -43,7 +43,7 @@ fn cargo_read_manifest_path_to_cargo_toml_relative() { .arg("--manifest-path") .arg("foo/Cargo.toml") .cwd(p.root().parent().unwrap()), - execs().with_status(0).with_json(MANIFEST_OUTPUT), + execs().with_json(MANIFEST_OUTPUT), ); } @@ -59,7 +59,7 @@ fn cargo_read_manifest_path_to_cargo_toml_absolute() { .arg("--manifest-path") .arg(p.root().join("Cargo.toml")) .cwd(p.root().parent().unwrap()), - execs().with_status(0).with_json(MANIFEST_OUTPUT), + execs().with_json(MANIFEST_OUTPUT), ); } @@ -110,6 +110,6 @@ fn cargo_read_manifest_cwd() { assert_that( p.cargo("read-manifest").cwd(p.root()), - execs().with_status(0).with_json(MANIFEST_OUTPUT), + execs().with_json(MANIFEST_OUTPUT), ); } diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index d5d0b3d59eb..b1d3dec8430 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -40,7 +40,7 @@ fn simple() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [DOWNLOADING] bar v0.0.1 (registry `file://[..]`) @@ -53,12 +53,12 @@ fn simple() { )), ); - assert_that(p.cargo("clean"), execs().with_status(0)); + assert_that(p.cargo("clean"), execs()); // Don't download a second time assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] bar v0.0.1 [COMPILING] foo v0.0.1 ({dir}) @@ -92,7 +92,7 @@ fn deps() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) @@ -335,7 +335,7 @@ required by package `foo v0.0.1 ([..])` assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `{reg}` [DOWNLOADING] notyet v0.0.1 (registry `file://[..]`) @@ -393,7 +393,7 @@ required by package `foo v0.0.1 ([..])` assert_that( p.cargo("package"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [PACKAGING] foo v0.0.1 ({dir}) [VERIFYING] foo v0.0.1 ({dir}) @@ -430,7 +430,7 @@ fn lockfile_locks() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.0.1 (registry `file://[..]`) @@ -445,7 +445,7 @@ fn lockfile_locks() { p.root().move_into_the_past(); Package::new("bar", "0.0.2").publish(); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -471,7 +471,7 @@ fn lockfile_locks_transitively() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) @@ -489,7 +489,7 @@ fn lockfile_locks_transitively() { Package::new("baz", "0.0.2").publish(); Package::new("bar", "0.0.2").dep("baz", "*").publish(); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -520,7 +520,7 @@ fn yanks_are_not_used() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) @@ -590,13 +590,13 @@ fn yanks_in_lockfiles_are_ok() { Package::new("bar", "0.0.1").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); registry::registry_path().join("3").rm_rf(); Package::new("bar", "0.0.1").yanked(true).publish(); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); assert_that( p.cargo("update"), @@ -629,13 +629,13 @@ fn update_with_lockfile_if_packages_missing() { .build(); Package::new("bar", "0.0.1").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); p.root().move_into_the_past(); paths::home().join(".cargo/registry").rm_rf(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.0.1 (registry `file://[..]`) @@ -665,7 +665,7 @@ fn update_lockfile() { println!("0.0.1"); Package::new("bar", "0.0.1").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("bar", "0.0.2").publish(); Package::new("bar", "0.0.3").publish(); @@ -677,7 +677,7 @@ fn update_lockfile() { .arg("bar") .arg("--precise") .arg("0.0.2"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] bar v0.0.1 -> v0.0.2 @@ -688,7 +688,7 @@ fn update_lockfile() { println!("0.0.2 build"); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [DOWNLOADING] [..] v0.0.2 (registry `file://[..]`) [COMPILING] bar v0.0.2 @@ -702,7 +702,7 @@ fn update_lockfile() { println!("0.0.3 update"); assert_that( p.cargo("update -p bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] bar v0.0.2 -> v0.0.3 @@ -713,7 +713,7 @@ fn update_lockfile() { println!("0.0.3 build"); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [DOWNLOADING] [..] v0.0.3 (registry `file://[..]`) [COMPILING] bar v0.0.3 @@ -729,7 +729,7 @@ fn update_lockfile() { Package::new("spam", "0.2.5").publish(); assert_that( p.cargo("update -p bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] bar v0.0.3 -> v0.0.4 @@ -742,7 +742,7 @@ fn update_lockfile() { Package::new("bar", "0.0.5").publish(); assert_that( p.cargo("update -p bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] bar v0.0.4 -> v0.0.5 @@ -803,7 +803,7 @@ fn dev_dependency_not_used() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) @@ -822,7 +822,7 @@ fn login_with_no_cargo_dir() { t!(fs::create_dir(&home)); assert_that( cargo_process("login foo -v"), - execs().with_status(0), + execs(), ); } @@ -833,15 +833,15 @@ fn login_with_differently_sized_token() { t!(fs::create_dir(&home)); assert_that( cargo_process("login lmaolmaolmao -v"), - execs().with_status(0), + execs(), ); assert_that( cargo_process("login lmao -v"), - execs().with_status(0), + execs(), ); assert_that( cargo_process("login lmaolmaolmao -v"), - execs().with_status(0), + execs(), ); } @@ -909,7 +909,7 @@ fn updating_a_dep() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.0.1 (registry `file://[..]`) @@ -938,7 +938,7 @@ fn updating_a_dep() { println!("second"); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.1.0 (registry `file://[..]`) @@ -996,7 +996,7 @@ fn git_and_registry_dep() { p.root().move_into_the_past(); assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] [..] [UPDATING] [..] @@ -1012,7 +1012,7 @@ fn git_and_registry_dep() { p.root().move_into_the_past(); println!("second"); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -1035,7 +1035,7 @@ fn update_publish_then_update() { .file("src/main.rs", "fn main() {}") .build(); Package::new("a", "0.1.0").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // Next, publish a new package and back up the copy of the registry we just // created. @@ -1061,7 +1061,7 @@ fn update_publish_then_update() { ) .file("src/main.rs", "fn main() {}") .build(); - assert_that(p2.cargo("build"), execs().with_status(0)); + assert_that(p2.cargo("build"), execs()); registry.rm_rf(); t!(fs::rename(&backup, ®istry)); t!(fs::rename( @@ -1074,7 +1074,7 @@ fn update_publish_then_update() { // then build everything again. assert_that( p.cargo("build"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [UPDATING] [..] [DOWNLOADING] a v0.1.1 (registry `file://[..]`) @@ -1109,7 +1109,7 @@ fn fetch_downloads() { assert_that( p.cargo("fetch"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] a v0.1.0 (registry [..]) @@ -1139,13 +1139,13 @@ fn update_transitive_dependency() { Package::new("a", "0.1.0").dep("b", "*").publish(); Package::new("b", "0.1.0").publish(); - assert_that(p.cargo("fetch"), execs().with_status(0)); + assert_that(p.cargo("fetch"), execs()); Package::new("b", "0.1.1").publish(); assert_that( p.cargo("update -pb"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] b v0.1.0 -> v0.1.1 @@ -1155,7 +1155,7 @@ fn update_transitive_dependency() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [DOWNLOADING] b v0.1.1 (registry `file://[..]`) [COMPILING] b v0.1.1 @@ -1197,7 +1197,7 @@ fn update_backtracking_ok() { .publish(); Package::new("openssl", "0.1.0").publish(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); Package::new("openssl", "0.1.1").publish(); Package::new("hyper", "0.6.6") @@ -1207,7 +1207,7 @@ fn update_backtracking_ok() { assert_that( p.cargo("update -p hyper"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] hyper v0.6.5 -> v0.6.6 @@ -1241,7 +1241,7 @@ fn update_multiple_packages() { Package::new("b", "0.1.0").publish(); Package::new("c", "0.1.0").publish(); - assert_that(p.cargo("fetch"), execs().with_status(0)); + assert_that(p.cargo("fetch"), execs()); Package::new("a", "0.1.1").publish(); Package::new("b", "0.1.1").publish(); @@ -1249,7 +1249,7 @@ fn update_multiple_packages() { assert_that( p.cargo("update -pa -pb"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] a v0.1.0 -> v0.1.1 @@ -1260,7 +1260,7 @@ fn update_multiple_packages() { assert_that( p.cargo("update -pb -pc"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] c v0.1.0 -> v0.1.1 @@ -1271,7 +1271,6 @@ fn update_multiple_packages() { assert_that( p.cargo("build"), execs() - .with_status(0) .with_stderr_contains("[DOWNLOADING] a v0.1.1 (registry `file://[..]`)") .with_stderr_contains("[DOWNLOADING] b v0.1.1 (registry `file://[..]`)") .with_stderr_contains("[DOWNLOADING] c v0.1.1 (registry `file://[..]`)") @@ -1321,7 +1320,7 @@ fn bundled_crate_in_registry() { .file("bar/src/lib.rs", "") .publish(); - assert_that(p.cargo("run"), execs().with_status(0)); + assert_that(p.cargo("run"), execs()); } #[test] @@ -1347,10 +1346,10 @@ fn update_same_prefix_oh_my_how_was_this_a_bug() { .dep("foobar", "0.2.0") .publish(); - assert_that(p.cargo("generate-lockfile"), execs().with_status(0)); + assert_that(p.cargo("generate-lockfile"), execs()); assert_that( p.cargo("update -pfoobar --precise=0.2.0"), - execs().with_status(0), + execs(), ); } @@ -1374,7 +1373,7 @@ fn use_semver() { Package::new("foo", "1.2.3-alpha.0").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1405,7 +1404,7 @@ fn only_download_relevant() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] baz v0.1.0 ([..]) @@ -1440,7 +1439,7 @@ fn resolve_and_backtracking() { .publish(); Package::new("foo", "0.1.0").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1467,9 +1466,7 @@ fn upstream_warnings_on_extra_verbose() { assert_that( p.cargo("build -vv"), - execs() - .with_status(0) - .with_stderr_contains("[..]warning: function is never used[..]"), + execs().with_stderr_contains("[..]warning: function is never used[..]"), ); } @@ -1540,7 +1537,7 @@ fn add_dep_dont_update_registry() { Package::new("remote", "0.3.4").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); t!(t!(File::create(p.root().join("Cargo.toml"))).write_all( br#" @@ -1557,7 +1554,7 @@ fn add_dep_dont_update_registry() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.5.0 ([..]) [FINISHED] [..] @@ -1599,7 +1596,7 @@ fn bump_version_dont_update_registry() { Package::new("remote", "0.3.4").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); t!(t!(File::create(p.root().join("Cargo.toml"))).write_all( br#" @@ -1615,7 +1612,7 @@ fn bump_version_dont_update_registry() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.6.0 ([..]) [FINISHED] [..] @@ -1646,7 +1643,7 @@ fn old_version_req() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: parsed version requirement `0.2*` is no longer valid @@ -1715,7 +1712,7 @@ fn old_version_req_upstream() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] [..] [DOWNLOADING] [..] @@ -1773,7 +1770,7 @@ fn toml_lies_but_index_is_truth() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build -v"), execs().with_status(0)); + assert_that(p.cargo("build -v"), execs()); } #[test] @@ -1798,7 +1795,7 @@ fn vv_prints_warnings() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build -vv"), execs().with_status(0)); + assert_that(p.cargo("build -vv"), execs()); } #[test] @@ -1867,7 +1864,7 @@ fn git_init_templatedir_missing() { assert_that( p.cargo("build"), - execs().with_status(0) + execs() ); remove_dir_all(paths::home().join(".cargo/registry")).unwrap(); @@ -1881,10 +1878,10 @@ fn git_init_templatedir_missing() { assert_that( p.cargo("build"), - execs().with_status(0) + execs() ); assert_that( p.cargo("build"), - execs().with_status(0) + execs() ); } diff --git a/tests/testsuite/rename_deps.rs b/tests/testsuite/rename_deps.rs index 3bb20c685d5..8b101d391b9 100644 --- a/tests/testsuite/rename_deps.rs +++ b/tests/testsuite/rename_deps.rs @@ -94,7 +94,7 @@ fn rename_dependency() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } @@ -133,7 +133,7 @@ fn rename_with_different_names() { assert_that( p.cargo("build").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } @@ -199,7 +199,7 @@ fn lots_of_names() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } @@ -232,7 +232,7 @@ fn rename_and_patch() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } @@ -296,7 +296,7 @@ fn rename_affects_fingerprint() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); p.change_file( @@ -351,7 +351,7 @@ fn can_run_doc_tests() { assert_that( foo.cargo("test").arg("-v").masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr_contains(format!( + execs().with_stderr_contains(format!( "\ [DOCTEST] foo [RUNNING] `rustdoc --test {dir}/src/lib.rs \ @@ -422,7 +422,7 @@ fn features_still_work() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/required_features.rs b/tests/testsuite/required_features.rs index 20d420d14fc..f90f6262b3b 100644 --- a/tests/testsuite/required_features.rs +++ b/tests/testsuite/required_features.rs @@ -39,15 +39,15 @@ fn build_bin_default_features() { .file("src/lib.rs", r#"#[cfg(feature = "a")] pub fn foo() {}"#) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( p.cargo("build").arg("--no-default-features"), - execs().with_status(0), + execs(), ); - assert_that(p.cargo("build").arg("--bin=foo"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--bin=foo"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( @@ -87,7 +87,7 @@ fn build_bin_arg_features() { assert_that( p.cargo("build").arg("--features").arg("a"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); } @@ -124,14 +124,14 @@ fn build_bin_multiple_required_features() { .file("src/foo_2.rs", "fn main() {}") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo_1"), is_not(existing_file())); assert_that(&p.bin("foo_2"), existing_file()); assert_that( p.cargo("build").arg("--features").arg("c"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo_1"), existing_file()); @@ -139,7 +139,7 @@ fn build_bin_multiple_required_features() { assert_that( p.cargo("build").arg("--no-default-features"), - execs().with_status(0), + execs(), ); } @@ -168,7 +168,7 @@ fn build_example_default_features() { assert_that( p.cargo("build").arg("--example=foo"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("examples/foo"), existing_file()); @@ -212,7 +212,7 @@ fn build_example_arg_features() { .arg("--example=foo") .arg("--features") .arg("a"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("examples/foo"), existing_file()); } @@ -258,7 +258,7 @@ Consider enabling them by passing e.g. `--features=\"b c\"` ); assert_that( p.cargo("build").arg("--example=foo_2"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("examples/foo_1"), is_not(existing_file())); @@ -269,14 +269,14 @@ Consider enabling them by passing e.g. `--features=\"b c\"` .arg("--example=foo_1") .arg("--features") .arg("c"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build") .arg("--example=foo_2") .arg("--features") .arg("c"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("examples/foo_1"), existing_file()); @@ -332,7 +332,6 @@ fn test_default_features() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -346,7 +345,6 @@ fn test_default_features() { assert_that( p.cargo("test").arg("--no-default-features"), execs() - .with_status(0) .with_stderr(format!( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )) @@ -356,7 +354,6 @@ fn test_default_features() { assert_that( p.cargo("test").arg("--test=foo"), execs() - .with_status(0) .with_stderr(format!( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -403,7 +400,6 @@ fn test_arg_features() { assert_that( p.cargo("test").arg("--features").arg("a"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -448,7 +444,6 @@ fn test_multiple_required_features() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -462,7 +457,6 @@ fn test_multiple_required_features() { assert_that( p.cargo("test").arg("--features").arg("c"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -477,7 +471,6 @@ fn test_multiple_required_features() { assert_that( p.cargo("test").arg("--no-default-features"), execs() - .with_status(0) .with_stderr(format!( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )) @@ -524,7 +517,6 @@ fn bench_default_features() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -538,7 +530,6 @@ fn bench_default_features() { assert_that( p.cargo("bench").arg("--no-default-features"), execs() - .with_status(0) .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]")) .with_stdout(""), ); @@ -546,7 +537,6 @@ fn bench_default_features() { assert_that( p.cargo("bench").arg("--bench=foo"), execs() - .with_status(0) .with_stderr(format!( "\ [FINISHED] release [optimized] target(s) in [..] @@ -606,7 +596,6 @@ fn bench_arg_features() { assert_that( p.cargo("bench").arg("--features").arg("a"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -673,7 +662,6 @@ fn bench_multiple_required_features() { assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -687,7 +675,6 @@ fn bench_multiple_required_features() { assert_that( p.cargo("bench").arg("--features").arg("c"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -702,7 +689,6 @@ fn bench_multiple_required_features() { assert_that( p.cargo("bench").arg("--no-default-features"), execs() - .with_status(0) .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]")) .with_stdout(""), ); @@ -736,9 +722,9 @@ fn install_default_features() { .file("examples/foo.rs", "fn main() {}") .build(); - assert_that(p.cargo("install --path ."), execs().with_status(0)); + assert_that(p.cargo("install --path ."), execs()); assert_that(cargo_home(), has_installed_exe("foo")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); assert_that( p.cargo("install --path .").arg("--no-default-features"), @@ -754,10 +740,10 @@ fn install_default_features() { assert_that( p.cargo("install --path .").arg("--bin=foo"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); assert_that( p.cargo("install --path .") @@ -779,10 +765,10 @@ Consider enabling them by passing e.g. `--features=\"a\"` assert_that( p.cargo("install --path .").arg("--example=foo"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); assert_that( p.cargo("install --path .") @@ -827,10 +813,10 @@ fn install_arg_features() { assert_that( p.cargo("install").arg("--features").arg("a"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); } #[test] @@ -865,18 +851,18 @@ fn install_multiple_required_features() { .file("src/foo_2.rs", "fn main() {}") .build(); - assert_that(p.cargo("install --path ."), execs().with_status(0)); + assert_that(p.cargo("install --path ."), execs()); assert_that(cargo_home(), is_not(has_installed_exe("foo_1"))); assert_that(cargo_home(), has_installed_exe("foo_2")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); assert_that( p.cargo("install --path .").arg("--features").arg("c"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo_1")); assert_that(cargo_home(), has_installed_exe("foo_2")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); assert_that( p.cargo("install --path .").arg("--no-default-features"), @@ -951,16 +937,16 @@ fn dep_feature_in_toml() { .file("bar/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // bin - assert_that(p.cargo("build").arg("--bin=foo"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--bin=foo"), execs()); assert_that(&p.bin("foo"), existing_file()); // example assert_that( p.cargo("build").arg("--example=foo"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("examples/foo"), existing_file()); @@ -968,7 +954,6 @@ fn dep_feature_in_toml() { assert_that( p.cargo("test").arg("--test=foo"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -984,7 +969,6 @@ fn dep_feature_in_toml() { assert_that( p.cargo("bench").arg("--bench=foo"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] bar v0.0.1 ({0}/bar) @@ -998,9 +982,9 @@ fn dep_feature_in_toml() { } // install - assert_that(p.cargo("install"), execs().with_status(0)); + assert_that(p.cargo("install"), execs()); assert_that(cargo_home(), has_installed_exe("foo")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); } #[test] @@ -1062,7 +1046,7 @@ fn dep_feature_in_cmd_line() { .file("bar/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // bin assert_that( @@ -1080,7 +1064,7 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` .arg("--bin=foo") .arg("--features") .arg("bar/a"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); @@ -1100,7 +1084,7 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` .arg("--example=foo") .arg("--features") .arg("bar/a"), - execs().with_status(0), + execs(), ); assert_that(&p.bin("examples/foo"), existing_file()); @@ -1108,7 +1092,6 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )) @@ -1121,7 +1104,6 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` .arg("--features") .arg("bar/a"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -1137,7 +1119,6 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]")) .with_stdout(""), ); @@ -1148,7 +1129,6 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` .arg("--features") .arg("bar/a"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] bar v0.0.1 ({0}/bar) @@ -1176,10 +1156,10 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"` assert_that( p.cargo("install").arg("--features").arg("bar/a"), - execs().with_status(0), + execs(), ); assert_that(cargo_home(), has_installed_exe("foo")); - assert_that(p.cargo("uninstall").arg("foo"), execs().with_status(0)); + assert_that(p.cargo("uninstall").arg("foo"), execs()); } #[test] @@ -1210,7 +1190,6 @@ fn test_skips_compiling_bin_with_missing_required_features() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -1239,7 +1218,6 @@ error[E0463]: can't find crate for `bar`", assert_that( p.cargo("bench"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -1302,7 +1280,7 @@ Consider enabling them by passing e.g. `--features=\"a\"` assert_that( p.cargo("run").arg("--features").arg("a"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/resolve.rs b/tests/testsuite/resolve.rs index ddbb83a024c..a7ff4a6ec90 100644 --- a/tests/testsuite/resolve.rs +++ b/tests/testsuite/resolve.rs @@ -415,7 +415,7 @@ fn minimal_version_cli() { p.cargo("generate-lockfile") .masquerade_as_nightly_cargo() .arg("-Zminimal-versions"), - execs().with_status(0), + execs(), ); let lock = p.read_lockfile(); diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 473b26894be..14d0869bdd9 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -12,7 +12,6 @@ fn simple() { assert_that( p.cargo("run"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -33,12 +32,12 @@ fn simple_quiet() { assert_that( p.cargo("run -q"), - execs().with_status(0).with_stdout("hello"), + execs().with_stdout("hello"), ); assert_that( p.cargo("run --quiet"), - execs().with_status(0).with_stdout("hello"), + execs().with_stdout("hello"), ); } @@ -69,7 +68,7 @@ fn quiet_and_verbose_config() { .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - assert_that(p.cargo("run").arg("-q"), execs().with_status(0)); + assert_that(p.cargo("run").arg("-q"), execs()); } #[test] @@ -88,7 +87,7 @@ fn simple_with_args() { assert_that( p.cargo("run").arg("hello").arg("world"), - execs().with_status(0), + execs(), ); } @@ -209,7 +208,6 @@ fn specify_name() { assert_that( p.cargo("run").arg("--bin").arg("a").arg("-v"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -225,7 +223,6 @@ fn specify_name() { assert_that( p.cargo("run").arg("--bin").arg("b").arg("-v"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) @@ -260,19 +257,16 @@ fn specify_default_run() { assert_that( p.cargo("run").masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stdout("hello A"), ); assert_that( p.cargo("run").masquerade_as_nightly_cargo().arg("--bin").arg("a"), execs() - .with_status(0) .with_stdout("hello A"), ); assert_that( p.cargo("run").masquerade_as_nightly_cargo().arg("--bin").arg("b"), execs() - .with_status(0) .with_stdout("hello B"), ); } @@ -366,7 +360,6 @@ fn run_example() { assert_that( p.cargo("run").arg("--example").arg("a"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -493,7 +486,6 @@ fn run_example_autodiscover_2015_with_autoexamples_enabled() { .arg("a") .masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -536,7 +528,6 @@ fn run_example_autodiscover_2018() { .arg("a") .masquerade_as_nightly_cargo(), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -646,7 +637,6 @@ fn one_bin_multiple_examples() { assert_that( p.cargo("run"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -711,7 +701,6 @@ fn example_with_release_flag() { .arg("--example") .arg("a"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] bar v0.5.0 ({url}/bar) @@ -745,7 +734,6 @@ fast2", assert_that( p.cargo("run").arg("-v").arg("--example").arg("a"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] bar v0.5.0 ({url}/bar) @@ -811,7 +799,7 @@ fn run_dylib_dep() { assert_that( p.cargo("run").arg("hello").arg("world"), - execs().with_status(0), + execs(), ); } @@ -828,7 +816,7 @@ fn release_works() { assert_that( p.cargo("run").arg("--release"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] release [optimized] target(s) in [..] @@ -858,7 +846,7 @@ fn run_bin_different_name() { .file("src/bar.rs", "fn main() {}") .build(); - assert_that(p.cargo("run"), execs().with_status(0)); + assert_that(p.cargo("run"), execs()); } #[test] @@ -880,7 +868,7 @@ fn dashes_are_forwarded() { assert_that( p.cargo("run -- -- a -- b"), - execs().with_status(0), + execs(), ); } @@ -896,7 +884,6 @@ fn run_from_executable_folder() { assert_that( p.cargo("run").cwd(cwd), execs() - .with_status(0) .with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n\ @@ -958,7 +945,7 @@ fn run_with_library_paths() { ) .build(); - assert_that(p.cargo("run"), execs().with_status(0)); + assert_that(p.cargo("run"), execs()); } #[test] @@ -1016,7 +1003,7 @@ fn library_paths_sorted_alphabetically() { ) .build(); - assert_that(p.cargo("run"), execs().with_status(0)); + assert_that(p.cargo("run"), execs()); } #[test] @@ -1072,15 +1059,15 @@ fn run_multiple_packages() { assert_that( cargo().arg("-p").arg("d1"), - execs().with_status(0).with_stdout("d1"), + execs().with_stdout("d1"), ); assert_that( cargo().arg("-p").arg("d2").arg("--bin").arg("d2"), - execs().with_status(0).with_stdout("d2"), + execs().with_stdout("d2"), ); - assert_that(cargo(), execs().with_status(0).with_stdout("foo")); + assert_that(cargo(), execs().with_stdout("foo")); assert_that(cargo().arg("-p").arg("d1").arg("-p").arg("d2"), execs() @@ -1109,5 +1096,5 @@ fn explicit_bin_with_args() { ) .build(); - assert_that(p.cargo("run --bin foo hello world"), execs().with_status(0)); + assert_that(p.cargo("run --bin foo hello world"), execs()); } diff --git a/tests/testsuite/rustc.rs b/tests/testsuite/rustc.rs index f5ce0d40ebe..cc3f6ff7d8a 100644 --- a/tests/testsuite/rustc.rs +++ b/tests/testsuite/rustc.rs @@ -14,7 +14,7 @@ fn build_lib_for_foo() { assert_that( p.cargo("rustc").arg("--lib").arg("-v"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \ @@ -44,7 +44,7 @@ fn lib() { .arg("--") .arg("-C") .arg("debug-assertions=off"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib \ @@ -70,7 +70,7 @@ fn build_main_and_allow_unstable_options() { assert_that( p.cargo("rustc -v --bin foo -- -C debug-assertions"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] {name} v{version} ({url}) [RUNNING] `rustc --crate-name {name} src/lib.rs --crate-type lib \ @@ -123,7 +123,7 @@ fn build_with_args_to_one_of_multiple_binaries() { assert_that( p.cargo("rustc -v --bin bar -- -C debug-assertions"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib --emit=dep-info,link \ @@ -168,7 +168,7 @@ fn build_with_args_to_one_of_multiple_tests() { assert_that( p.cargo("rustc -v --test bar -- -C debug-assertions"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc --crate-name foo src/lib.rs --crate-type lib --emit=dep-info,link \ @@ -211,7 +211,7 @@ fn build_foo_with_bar_dependency() { .arg("--") .arg("-C") .arg("debug-assertions"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [COMPILING] bar v0.1.0 ([..]) [RUNNING] `[..] -C debuginfo=2 [..]` @@ -248,7 +248,7 @@ fn build_only_bar_dependency() { assert_that( foo.cargo("rustc -v -p bar -- -C debug-assertions"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] bar v0.1.0 ([..]) [RUNNING] `rustc --crate-name bar [..] --crate-type lib [..] -C debug-assertions [..]` @@ -265,7 +265,7 @@ fn targets_selected_default() { .build(); assert_that( p.cargo("rustc").arg("-v"), - execs().with_status(0) + execs() // bin .with_stderr_contains("\ [RUNNING] `rustc --crate-name foo src/main.rs --crate-type bin \ @@ -288,7 +288,7 @@ fn targets_selected_all() { .build(); assert_that( p.cargo("rustc").arg("-v").arg("--all-targets"), - execs().with_status(0) + execs() // bin .with_stderr_contains("\ [RUNNING] `rustc --crate-name foo src/main.rs --crate-type bin \ @@ -390,7 +390,7 @@ fn rustc_with_other_profile() { assert_that( p.cargo("rustc").arg("--profile").arg("test"), - execs().with_status(0), + execs(), ); } @@ -404,7 +404,7 @@ fn rustc_fingerprint() { assert_that( p.cargo("rustc -v -- -C debug-assertions"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo [..] [RUNNING] `rustc [..]-C debug-assertions [..] @@ -415,7 +415,7 @@ fn rustc_fingerprint() { assert_that( p.cargo("rustc -v -- -C debug-assertions"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] foo [..] [FINISHED] [..] @@ -426,7 +426,6 @@ fn rustc_fingerprint() { assert_that( p.cargo("rustc -v"), execs() - .with_status(0) .with_stderr_does_not_contain("-C debug-assertions") .with_stderr( "\ @@ -439,7 +438,7 @@ fn rustc_fingerprint() { assert_that( p.cargo("rustc -v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [FRESH] foo [..] [FINISHED] [..] @@ -471,7 +470,6 @@ fn rustc_test_with_implicit_bin() { assert_that( p.cargo("rustc --test test1 -v -- --cfg foo"), execs() - .with_status(0) .with_stderr_contains( "\ [RUNNING] `rustc --crate-name test1 tests/test1.rs [..] --cfg foo [..] diff --git a/tests/testsuite/rustc_info_cache.rs b/tests/testsuite/rustc_info_cache.rs index f2a099d0519..cdbe9c2ccc9 100644 --- a/tests/testsuite/rustc_info_cache.rs +++ b/tests/testsuite/rustc_info_cache.rs @@ -16,7 +16,6 @@ fn rustc_info_cache() { assert_that( p.cargo("build").env("RUST_LOG", "cargo::util::rustc=info"), execs() - .with_status(0) .with_stderr_contains("[..]failed to read rustc info cache[..]") .with_stderr_contains(miss) .with_stderr_does_not_contain(hit) @@ -26,7 +25,6 @@ fn rustc_info_cache() { assert_that( p.cargo("build").env("RUST_LOG", "cargo::util::rustc=info"), execs() - .with_status(0) .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) .with_stderr_does_not_contain(miss) @@ -38,7 +36,6 @@ fn rustc_info_cache() { .env("RUST_LOG", "cargo::util::rustc=info") .env("CARGO_CACHE_RUSTC_INFO", "0"), execs() - .with_status(0) .with_stderr_contains("[..]rustc info cache disabled[..]") .with_stderr_does_not_contain(update), ); @@ -62,7 +59,7 @@ fn rustc_info_cache() { "#, ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); p.root() .join("target/debug/compiler") @@ -74,7 +71,6 @@ fn rustc_info_cache() { .env("RUST_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()), execs() - .with_status(0) .with_stderr_contains("[..]different compiler, creating new rustc info cache[..]") .with_stderr_contains(miss) .with_stderr_does_not_contain(hit) @@ -86,7 +82,6 @@ fn rustc_info_cache() { .env("RUST_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()), execs() - .with_status(0) .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) .with_stderr_does_not_contain(miss) @@ -100,7 +95,6 @@ fn rustc_info_cache() { .env("RUST_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()), execs() - .with_status(0) .with_stderr_contains("[..]different compiler, creating new rustc info cache[..]") .with_stderr_contains(miss) .with_stderr_does_not_contain(hit) @@ -112,7 +106,6 @@ fn rustc_info_cache() { .env("RUST_LOG", "cargo::util::rustc=info") .env("RUSTC", other_rustc.display().to_string()), execs() - .with_status(0) .with_stderr_contains("[..]reusing existing rustc info cache[..]") .with_stderr_contains(hit) .with_stderr_does_not_contain(miss) diff --git a/tests/testsuite/rustdoc.rs b/tests/testsuite/rustdoc.rs index 987d82fba74..7ca9e32eb77 100644 --- a/tests/testsuite/rustdoc.rs +++ b/tests/testsuite/rustdoc.rs @@ -9,7 +9,7 @@ fn rustdoc_simple() { assert_that( p.cargo("rustdoc").arg("-v"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [DOCUMENTING] foo v0.0.1 ({url}) [RUNNING] `rustdoc --crate-name foo src/lib.rs \ @@ -31,7 +31,7 @@ fn rustdoc_args() { assert_that( p.cargo("rustdoc").arg("-v").arg("--").arg("--cfg=foo"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [DOCUMENTING] foo v0.0.1 ({url}) [RUNNING] `rustdoc --crate-name foo src/lib.rs \ @@ -70,7 +70,7 @@ fn rustdoc_foo_with_bar_dependency() { assert_that( foo.cargo("rustdoc").arg("-v").arg("--").arg("--cfg=foo"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [CHECKING] bar v0.0.1 ([..]) [RUNNING] `rustc [..]bar/src/lib.rs [..]` @@ -117,7 +117,7 @@ fn rustdoc_only_bar_dependency() { .arg("bar") .arg("--") .arg("--cfg=foo"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [DOCUMENTING] bar v0.0.1 ([..]) [RUNNING] `rustdoc --crate-name bar [..]bar/src/lib.rs \ @@ -140,7 +140,7 @@ fn rustdoc_same_name_documents_lib() { assert_that( p.cargo("rustdoc").arg("-v").arg("--").arg("--cfg=foo"), - execs().with_status(0).with_stderr(format!( + execs().with_stderr(format!( "\ [DOCUMENTING] foo v0.0.1 ([..]) [RUNNING] `rustdoc --crate-name foo src/lib.rs \ @@ -175,7 +175,6 @@ fn features() { assert_that( p.cargo("rustdoc --verbose --features quux"), execs() - .with_status(0) .with_stderr_contains("[..]feature=[..]quux[..]"), ); } @@ -189,7 +188,7 @@ fn rustdoc_target() { assert_that( p.cargo("rustdoc --verbose --target x86_64-unknown-linux-gnu"), - execs().with_status(0).with_stderr("\ + execs().with_stderr("\ [DOCUMENTING] foo v0.0.1 ([..]) [RUNNING] `rustdoc --crate-name foo src/lib.rs \ --target x86_64-unknown-linux-gnu \ diff --git a/tests/testsuite/rustdocflags.rs b/tests/testsuite/rustdocflags.rs index ac713cd3800..15eaa1f687f 100644 --- a/tests/testsuite/rustdocflags.rs +++ b/tests/testsuite/rustdocflags.rs @@ -10,7 +10,6 @@ fn parses_env() { assert_that( p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustdoc [..] --cfg=foo[..]`"), ); } @@ -31,7 +30,6 @@ fn parses_config() { assert_that( p.cargo("doc").arg("-v"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] `rustdoc [..] --cfg foo[..]`"), ); } @@ -56,17 +54,16 @@ fn rerun() { assert_that( p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo"), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=bar"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [DOCUMENTING] foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -92,7 +89,7 @@ fn rustdocflags_passed_to_rustdoc_through_cargo_test() { p.cargo("test") .arg("--doc") .env("RUSTDOCFLAGS", "--cfg do_not_choke"), - execs().with_status(0), + execs(), ); } @@ -106,6 +103,6 @@ fn rustdocflags_passed_to_rustdoc_through_cargo_test_only_once() { p.cargo("test") .arg("--doc") .env("RUSTDOCFLAGS", "--markdown-no-toc"), - execs().with_status(0), + execs(), ); } diff --git a/tests/testsuite/rustflags.rs b/tests/testsuite/rustflags.rs index 825ba3e4a18..1c81ee21d81 100644 --- a/tests/testsuite/rustflags.rs +++ b/tests/testsuite/rustflags.rs @@ -74,7 +74,7 @@ fn env_rustflags_build_script() { assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); } @@ -113,7 +113,7 @@ fn env_rustflags_build_script_dep() { assert_that( foo.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); } @@ -147,7 +147,7 @@ fn env_rustflags_plugin() { assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); } @@ -188,7 +188,7 @@ fn env_rustflags_plugin_dep() { assert_that( foo.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); } @@ -283,7 +283,7 @@ fn env_rustflags_build_script_with_target() { .env("RUSTFLAGS", "--cfg foo") .arg("--target") .arg(host), - execs().with_status(0), + execs(), ); } @@ -326,7 +326,7 @@ fn env_rustflags_build_script_dep_with_target() { .env("RUSTFLAGS", "--cfg foo") .arg("--target") .arg(host), - execs().with_status(0), + execs(), ); } @@ -364,7 +364,7 @@ fn env_rustflags_plugin_with_target() { .env("RUSTFLAGS", "--cfg foo") .arg("--target") .arg(host), - execs().with_status(0), + execs(), ); } @@ -409,7 +409,7 @@ fn env_rustflags_plugin_dep_with_target() { .env("RUSTFLAGS", "--cfg foo") .arg("--target") .arg(host), - execs().with_status(0), + execs(), ); } @@ -419,7 +419,7 @@ fn env_rustflags_recompile() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // Setting RUSTFLAGS forces a recompile assert_that( p.cargo("build").env("RUSTFLAGS", "-Z bogus"), @@ -435,7 +435,7 @@ fn env_rustflags_recompile2() { assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); // Setting RUSTFLAGS forces a recompile assert_that( @@ -452,11 +452,11 @@ fn env_rustflags_no_recompile() { assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_stdout("").with_status(0), + execs().with_stdout(""), ); } @@ -526,7 +526,7 @@ fn build_rustflags_build_script() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -569,7 +569,7 @@ fn build_rustflags_build_script_dep() { ) .build(); - assert_that(foo.cargo("build"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); } #[test] @@ -607,7 +607,7 @@ fn build_rustflags_plugin() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -652,7 +652,7 @@ fn build_rustflags_plugin_dep() { ) .build(); - assert_that(foo.cargo("build"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); } #[test] @@ -742,7 +742,7 @@ fn build_rustflags_build_script_with_target() { let host = rustc_host(); assert_that( p.cargo("build").arg("--target").arg(host), - execs().with_status(0), + execs(), ); } @@ -789,7 +789,7 @@ fn build_rustflags_build_script_dep_with_target() { let host = rustc_host(); assert_that( foo.cargo("build").arg("--target").arg(host), - execs().with_status(0), + execs(), ); } @@ -831,7 +831,7 @@ fn build_rustflags_plugin_with_target() { let host = rustc_host(); assert_that( p.cargo("build").arg("--target").arg(host), - execs().with_status(0), + execs(), ); } @@ -880,7 +880,7 @@ fn build_rustflags_plugin_dep_with_target() { let host = rustc_host(); assert_that( foo.cargo("build").arg("--target").arg(host), - execs().with_status(0), + execs(), ); } @@ -890,7 +890,7 @@ fn build_rustflags_recompile() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); // Setting RUSTFLAGS forces a recompile let config = r#" @@ -913,7 +913,7 @@ fn build_rustflags_recompile2() { assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); // Setting RUSTFLAGS forces a recompile @@ -944,11 +944,11 @@ fn build_rustflags_no_recompile() { assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").env("RUSTFLAGS", "--cfg foo"), - execs().with_stdout("").with_status(0), + execs().with_stdout(""), ); } @@ -974,7 +974,7 @@ fn build_rustflags_with_home_config() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); } #[test] @@ -1068,7 +1068,7 @@ fn cfg_rustflags_normal_source() { assert_that( p.cargo("build").arg("--lib").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1079,7 +1079,7 @@ fn cfg_rustflags_normal_source() { assert_that( p.cargo("build").arg("--bin=a").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1090,7 +1090,7 @@ fn cfg_rustflags_normal_source() { assert_that( p.cargo("build").arg("--example=b").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1101,7 +1101,7 @@ fn cfg_rustflags_normal_source() { assert_that( p.cargo("test").arg("--no-run").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1114,7 +1114,7 @@ fn cfg_rustflags_normal_source() { assert_that( p.cargo("bench").arg("--no-run").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1155,7 +1155,7 @@ fn cfg_rustflags_precedence() { assert_that( p.cargo("build").arg("--lib").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1166,7 +1166,7 @@ fn cfg_rustflags_precedence() { assert_that( p.cargo("build").arg("--bin=a").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1177,7 +1177,7 @@ fn cfg_rustflags_precedence() { assert_that( p.cargo("build").arg("--example=b").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1188,7 +1188,7 @@ fn cfg_rustflags_precedence() { assert_that( p.cargo("test").arg("--no-run").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1201,7 +1201,7 @@ fn cfg_rustflags_precedence() { assert_that( p.cargo("bench").arg("--no-run").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg bar[..]` @@ -1228,7 +1228,7 @@ fn target_rustflags_string_and_array_form1() { assert_that( p1.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg foo[..]` @@ -1250,7 +1250,7 @@ fn target_rustflags_string_and_array_form1() { assert_that( p2.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg foo[..]` @@ -1278,7 +1278,7 @@ fn target_rustflags_string_and_array_form2() { assert_that( p1.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg foo[..]` @@ -1303,7 +1303,7 @@ fn target_rustflags_string_and_array_form2() { assert_that( p2.cargo("build").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] --cfg foo[..]` @@ -1345,9 +1345,9 @@ fn two_matching_in_config() { ) .build(); - assert_that(p1.cargo("run"), execs().with_status(0)); + assert_that(p1.cargo("run"), execs()); assert_that( p1.cargo("build"), - execs().with_status(0).with_stderr("[FINISHED] [..]"), + execs().with_stderr("[FINISHED] [..]"), ); } diff --git a/tests/testsuite/search.rs b/tests/testsuite/search.rs index f2feefc7ac6..f595c6b957e 100644 --- a/tests/testsuite/search.rs +++ b/tests/testsuite/search.rs @@ -110,7 +110,6 @@ fn not_update() { assert_that( cargo_process("search postgres"), execs() - .with_status(0) .with_stdout_contains( "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ) @@ -126,7 +125,6 @@ fn replace_default() { assert_that( cargo_process("search postgres"), execs() - .with_status(0) .with_stdout_contains( "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ) @@ -140,7 +138,7 @@ fn simple() { assert_that( cargo_process("search postgres --index").arg(registry_url().to_string()), - execs().with_status(0).with_stdout_contains( + execs().with_stdout_contains( "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ), ); @@ -155,7 +153,6 @@ fn simple_with_host() { assert_that( cargo_process("search postgres --host").arg(registry_url().to_string()), execs() - .with_status(0) .with_stderr(&format!( "\ [WARNING] The flag '--host' is no longer valid. @@ -186,7 +183,6 @@ fn simple_with_index_and_host() { assert_that( cargo_process("search postgres --index").arg(registry_url().to_string()).arg("--host").arg(registry_url().to_string()), execs() - .with_status(0) .with_stderr(&format!( "\ [WARNING] The flag '--host' is no longer valid. @@ -214,7 +210,7 @@ fn multiple_query_params() { assert_that( cargo_process("search postgres sql --index").arg(registry_url().to_string()), - execs().with_status(0).with_stdout_contains( + execs().with_stdout_contains( "hoare = \"0.1.1\" # Design by contract style assertions for Rust", ), ); @@ -222,8 +218,8 @@ fn multiple_query_params() { #[test] fn help() { - assert_that(cargo_process("search -h"), execs().with_status(0)); - assert_that(cargo_process("help search"), execs().with_status(0)); + assert_that(cargo_process("search -h"), execs()); + assert_that(cargo_process("help search"), execs()); // Ensure that help output goes to stdout, not stderr. assert_that( cargo_process("search --help"), diff --git a/tests/testsuite/small_fd_limits.rs b/tests/testsuite/small_fd_limits.rs index 759c245a762..b0e7f8a15b8 100644 --- a/tests/testsuite/small_fd_limits.rs +++ b/tests/testsuite/small_fd_limits.rs @@ -37,7 +37,7 @@ fn run_test(path_env: Option<&OsStr>) { .build(); Package::new("bar", "0.1.0").publish(); - assert_that(foo.cargo("build"), execs().with_status(0)); + assert_that(foo.cargo("build"), execs()); let index = find_index(); let path = paths::home().join("tmp"); @@ -75,7 +75,7 @@ fn run_test(path_env: Option<&OsStr>) { cmd.env("PATH", path); } cmd.env("RUST_LOG", "trace"); - assert_that(cmd, execs().with_status(0)); + assert_that(cmd, execs()); let after = find_index() .join(".git/objects/pack") .read_dir() diff --git a/tests/testsuite/support/mod.rs b/tests/testsuite/support/mod.rs index 3dd5e328e56..602e4f8a9e2 100644 --- a/tests/testsuite/support/mod.rs +++ b/tests/testsuite/support/mod.rs @@ -22,7 +22,6 @@ the output. assert_that( p.cargo("run --bin foo"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo [..] @@ -347,7 +346,7 @@ impl Project { /// Example: /// assert_that( /// p.process(&p.bin("foo")), - /// execs().with_status(0).with_stdout("bar\n"), + /// execs().with_stdout("bar\n"), /// ); pub fn process>(&self, program: T) -> ProcessBuilder { let mut p = ::support::process(program); @@ -358,7 +357,7 @@ impl Project { /// Create a `ProcessBuilder` to run cargo. /// Arguments can be separated by spaces. /// Example: - /// assert_that(p.cargo("build --bin foo"), execs().with_status(0)); + /// assert_that(p.cargo("build --bin foo"), execs()); pub fn cargo(&self, cmd: &str) -> ProcessBuilder { let mut p = self.process(&cargo_exe()); split_and_add_args(&mut p, cmd); @@ -1185,7 +1184,7 @@ pub fn execs() -> Execs { expect_stdout: None, expect_stderr: None, expect_stdin: None, - expect_exit_code: None, + expect_exit_code: Some(0), expect_stdout_contains: Vec::new(), expect_stderr_contains: Vec::new(), expect_either_contains: Vec::new(), diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 0c850a350d5..8f549211d07 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -32,18 +32,17 @@ fn cargo_test_simple() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("hello\n"), + execs().with_stdout("hello\n"), ); assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.5.0 ({}) @@ -96,7 +95,6 @@ fn cargo_test_release() { assert_that( p.cargo("test").arg("-v").arg("--release"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] bar v0.0.1 ({dir}/bar) @@ -151,12 +149,12 @@ fn cargo_test_overflow_checks() { ) .build(); - assert_that(p.cargo("build").arg("--release"), execs().with_status(0)); + assert_that(p.cargo("build").arg("--release"), execs()); assert_that(&p.release_bin("foo"), existing_file()); assert_that( process(&p.release_bin("foo")), - execs().with_status(0).with_stdout(""), + execs().with_stdout(""), ); } @@ -176,7 +174,6 @@ fn cargo_test_verbose() { assert_that( p.cargo("test").arg("-v").arg("hello"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.5.0 ({url}) @@ -257,12 +254,12 @@ fn cargo_test_failing_test_in_bin() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("hello\n"), + execs().with_stdout("hello\n"), ); assert_that( @@ -308,12 +305,12 @@ fn cargo_test_failing_test_in_test() { .file("tests/footest.rs", "#[test] fn test_hello() { assert!(false) }") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that( process(&p.bin("foo")), - execs().with_status(0).with_stdout("hello\n"), + execs().with_stdout("hello\n"), ); assert_that( @@ -438,7 +435,6 @@ fn test_with_lib_dep() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -494,7 +490,6 @@ fn test_with_deep_lib_dep() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] bar v0.0.1 ([..]) @@ -548,7 +543,6 @@ fn external_test_explicit() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -583,7 +577,7 @@ fn external_test_named_test() { .file("tests/test.rs", "#[test] fn foo() {}") .build(); - assert_that(p.cargo("test"), execs().with_status(0)) + assert_that(p.cargo("test"), execs()) } #[test] @@ -612,7 +606,6 @@ fn external_test_implicit() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -639,7 +632,7 @@ fn dont_run_examples() { "#, ) .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } #[test] @@ -657,7 +650,6 @@ fn pass_through_command_line() { assert_that( p.cargo("test").arg("bar"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -673,7 +665,6 @@ fn pass_through_command_line() { assert_that( p.cargo("test").arg("foo"), execs() - .with_status(0) .with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -705,7 +696,7 @@ fn cargo_test_twice() { p.cargo("build"); for _ in 0..2 { - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } } @@ -742,7 +733,6 @@ fn lib_bin_same_name() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({}) @@ -787,7 +777,6 @@ fn lib_with_standard_name() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] syntax v0.0.1 ({dir}) @@ -837,7 +826,6 @@ fn lib_with_standard_name2() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] syntax v0.0.1 ({dir}) @@ -882,7 +870,6 @@ fn lib_without_name() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] syntax v0.0.1 ({dir}) @@ -1205,7 +1192,6 @@ fn test_dylib() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] bar v0.0.1 ({dir}/bar) @@ -1222,7 +1208,6 @@ fn test_dylib() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -1253,7 +1238,6 @@ fn test_twice_with_build_cmd() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1269,7 +1253,6 @@ fn test_twice_with_build_cmd() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -1290,7 +1273,6 @@ fn test_then_build() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1303,7 +1285,7 @@ fn test_then_build() { .with_stdout_contains("running 0 tests"), ); - assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("build"), execs().with_stdout("")); } #[test] @@ -1314,7 +1296,7 @@ fn test_no_run() { assert_that( p.cargo("test").arg("--no-run"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -1351,7 +1333,6 @@ fn test_run_specific_bin_target() { assert_that( prj.cargo("test").arg("--bin").arg("bin2"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1396,7 +1377,6 @@ fn test_run_implicit_bin_target() { assert_that( prj.cargo("test").arg("--bins"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1420,7 +1400,6 @@ fn test_run_specific_test_target() { assert_that( prj.cargo("test").arg("--test").arg("b"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1464,7 +1443,6 @@ fn test_run_implicit_test_target() { assert_that( prj.cargo("test").arg("--tests"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1509,7 +1487,6 @@ fn test_run_implicit_bench_target() { assert_that( prj.cargo("test").arg("--benches"), execs() - .with_status(0) .with_stderr(format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1568,7 +1545,6 @@ fn test_run_implicit_example_target() { assert_that( prj.cargo("test -v"), execs() - .with_status(0) .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-[..]") @@ -1579,7 +1555,6 @@ fn test_run_implicit_example_target() { assert_that( prj.cargo("test --tests"), execs() - .with_status(0) .with_stderr_does_not_contain("[RUNNING] [..]myexm1-[..]") .with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm2-[..]"), ); @@ -1588,7 +1563,6 @@ fn test_run_implicit_example_target() { assert_that( prj.cargo("test --examples"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm1-[..]") .with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm2-[..]"), ); @@ -1597,7 +1571,6 @@ fn test_run_implicit_example_target() { assert_that( prj.cargo("test --example myexm1"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm1-[..]"), ); @@ -1605,7 +1578,6 @@ fn test_run_implicit_example_target() { assert_that( prj.cargo("test --all-targets"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm1-[..]") .with_stderr_contains("[RUNNING] [..]target/debug/examples/myexm2-[..]"), ); @@ -1638,7 +1610,7 @@ fn test_no_harness() { assert_that( p.cargo("test").arg("--").arg("--nocapture"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -1713,7 +1685,6 @@ fn selective_testing() { assert_that( p.cargo("test").arg("-p").arg("d1"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] d1 v0.0.1 ({dir}/d1) @@ -1729,7 +1700,6 @@ fn selective_testing() { assert_that( p.cargo("test").arg("-p").arg("d2"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] d2 v0.0.1 ({dir}/d2) @@ -1745,7 +1715,6 @@ fn selective_testing() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) @@ -1804,8 +1773,8 @@ fn almost_cyclic_but_not_quite() { .file("c/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); + assert_that(p.cargo("test"), execs()); } #[test] @@ -1838,9 +1807,9 @@ fn build_then_selective_test() { .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); p.root().move_into_the_past(); - assert_that(p.cargo("test").arg("-p").arg("b"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-p").arg("b"), execs()); } #[test] @@ -1880,14 +1849,14 @@ fn example_dev_dep() { "#, ) .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); assert_that( p.cargo("run") .arg("--example") .arg("e1") .arg("--release") .arg("-v"), - execs().with_status(0), + execs(), ); } @@ -1934,7 +1903,6 @@ fn selective_testing_with_docs() { assert_that( p.cargo("test").arg("-p").arg("d1"), execs() - .with_status(0) .with_stderr(&format!( "\ [COMPILING] d1 v0.0.1 ({dir}/d1) @@ -1956,7 +1924,7 @@ fn example_bin_same_name() { assert_that( p.cargo("test").arg("--no-run").arg("-v"), - execs().with_status(0).with_stderr(&format!( + execs().with_stderr(&format!( "\ [COMPILING] foo v0.0.1 ({dir}) [RUNNING] `rustc [..]` @@ -1972,13 +1940,12 @@ fn example_bin_same_name() { assert_that( p.process(&p.bin("examples/foo")), - execs().with_status(0).with_stdout("example\n"), + execs().with_stdout("example\n"), ); assert_that( p.cargo("run"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) @@ -1998,10 +1965,10 @@ fn test_with_example_twice() { .build(); println!("first"); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); assert_that(&p.bin("examples/foo"), existing_file()); println!("second"); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); assert_that(&p.bin("examples/foo"), existing_file()); } @@ -2036,7 +2003,7 @@ fn example_with_dev_dep() { assert_that( p.cargo("test").arg("-v"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..] [..] @@ -2056,11 +2023,11 @@ fn bin_is_preserved() { .file("src/main.rs", "fn main() {}") .build(); - assert_that(p.cargo("build").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("build").arg("-v"), execs()); assert_that(&p.bin("foo"), existing_file()); println!("testing"); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); assert_that(&p.bin("foo"), existing_file()); } @@ -2113,7 +2080,6 @@ fn doctest_feature() { assert_that( p.cargo("test").arg("--features").arg("bar"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo [..] @@ -2141,7 +2107,7 @@ fn dashes_to_underscores() { ) .build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } #[test] @@ -2172,7 +2138,7 @@ fn doctest_dev_dep() { .file("b/src/lib.rs", "") .build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } #[test] @@ -2193,7 +2159,6 @@ fn filter_no_doc_tests() { assert_that( p.cargo("test").arg("--test=foo"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) @@ -2235,7 +2200,6 @@ fn dylib_doctest() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) @@ -2275,7 +2239,7 @@ fn dylib_doctest2() { ) .build(); - assert_that(p.cargo("test"), execs().with_status(0).with_stdout("")); + assert_that(p.cargo("test"), execs().with_stdout("")); } #[test] @@ -2324,7 +2288,6 @@ fn cyclic_dev_dep_doc_test() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) @@ -2368,7 +2331,7 @@ fn dev_dep_with_build_script() { .file("bar/src/lib.rs", "") .file("bar/build.rs", "fn main() {}") .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); } #[test] @@ -2498,7 +2461,6 @@ fn test_multiple_packages() { assert_that( p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"), execs() - .with_status(0) .with_stderr_contains("[RUNNING] target/debug/deps/d1-[..][EXE]") .with_stderr_contains("[RUNNING] target/debug/deps/d2-[..][EXE]") .with_stdout_contains_n("running 0 tests", 2), @@ -2513,7 +2475,7 @@ fn bin_does_not_rebuild_tests() { .file("tests/foo.rs", ""); let p = p.build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); sleep_ms(1000); File::create(&p.root().join("src/main.rs")) @@ -2523,7 +2485,7 @@ fn bin_does_not_rebuild_tests() { assert_that( p.cargo("test").arg("-v").arg("--no-run"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] src/main.rs [..]` @@ -2559,7 +2521,7 @@ fn selective_test_wonky_profile() { assert_that( p.cargo("test -v --no-run --release -p foo -p a"), - execs().with_status(0), + execs(), ); } @@ -2591,7 +2553,7 @@ fn selective_test_optional_dep() { .arg("a") .arg("-p") .arg("a"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] a v0.0.1 ([..]) [RUNNING] `rustc [..] a/src/lib.rs [..]` @@ -2627,7 +2589,6 @@ fn only_test_docs() { assert_that( p.cargo("test").arg("--doc"), execs() - .with_status(0) .with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) @@ -2668,7 +2629,7 @@ fn test_panic_abort_with_dep() { .file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1")) .file("bar/src/lib.rs", "") .build(); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); } #[test] @@ -2691,7 +2652,7 @@ fn cfg_test_even_with_no_harness() { .build(); assert_that( p.cargo("test").arg("-v"), - execs().with_status(0).with_stdout("hello!\n").with_stderr( + execs().with_stdout("hello!\n").with_stderr( "\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..]` @@ -2729,7 +2690,7 @@ fn panic_abort_multiple() { .build(); assert_that( p.cargo("test --release -v -p foo -p a"), - execs().with_status(0), + execs(), ); } @@ -2809,7 +2770,7 @@ fn pass_correct_cfgs_flags_to_rustdoc() { .arg("--package") .arg("feature_a") .arg("--verbose"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [DOCTEST] feature_a [RUNNING] `rustdoc --test [..]mock_serde_codegen[..]`", @@ -2818,7 +2779,7 @@ fn pass_correct_cfgs_flags_to_rustdoc() { assert_that( p.cargo("test").arg("--verbose"), - execs().with_status(0).with_stderr_contains( + execs().with_stderr_contains( "\ [DOCTEST] foo [RUNNING] `rustdoc --test [..]feature_a[..]`", @@ -2854,9 +2815,9 @@ fn test_release_ignore_panic() { .file("a/src/lib.rs", ""); let p = p.build(); println!("test"); - assert_that(p.cargo("test").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("test").arg("-v"), execs()); println!("bench"); - assert_that(p.cargo("bench").arg("-v"), execs().with_status(0)); + assert_that(p.cargo("bench").arg("-v"), execs()); } #[test] @@ -2886,7 +2847,7 @@ fn test_many_with_features() { assert_that( p.cargo("test -v -p a -p foo --features foo"), - execs().with_status(0), + execs(), ); } @@ -2914,7 +2875,6 @@ fn test_all_workspace() { assert_that( p.cargo("test").arg("--all"), execs() - .with_status(0) .with_stdout_contains("test foo_test ... ok") .with_stdout_contains("test bar_test ... ok"), ); @@ -2943,7 +2903,7 @@ fn test_all_exclude() { assert_that( p.cargo("test").arg("--all").arg("--exclude").arg("baz"), - execs().with_status(0).with_stdout_contains( + execs().with_stdout_contains( "running 1 test test bar ... ok", ), @@ -2969,7 +2929,6 @@ fn test_all_virtual_manifest() { assert_that( p.cargo("test").arg("--all"), execs() - .with_status(0) .with_stdout_contains("test a ... ok") .with_stdout_contains("test b ... ok"), ); @@ -2994,7 +2953,6 @@ fn test_virtual_manifest_all_implied() { assert_that( p.cargo("test"), execs() - .with_status(0) .with_stdout_contains("test a ... ok") .with_stdout_contains("test b ... ok"), ); @@ -3028,7 +2986,7 @@ fn test_all_member_dependency_same_name() { assert_that( p.cargo("test").arg("--all"), - execs().with_status(0).with_stdout_contains("test a ... ok"), + execs().with_stdout_contains("test a ... ok"), ); } @@ -3063,7 +3021,7 @@ fn doctest_only_with_dev_dep() { assert_that( p.cargo("test").arg("--doc").arg("-v"), - execs().with_status(0), + execs(), ); } @@ -3127,7 +3085,6 @@ fn test_many_targets() { .arg("--test") .arg("b"), execs() - .with_status(0) .with_stdout_contains("test bin_a ... ok") .with_stdout_contains("test bin_b ... ok") .with_stdout_contains("test test_a ... ok") @@ -3183,7 +3140,7 @@ fn doctest_and_registry() { assert_that( p.cargo("test").arg("--all").arg("-v"), - execs().with_status(0), + execs(), ); } @@ -3210,7 +3167,7 @@ fn cargo_test_env() { let cargo = cargo_exe().canonicalize().unwrap(); assert_that( p.cargo("test --lib -- --nocapture"), - execs().with_status(0).with_stdout_contains(format!( + execs().with_stdout_contains(format!( "\ {} test env_test ... ok @@ -3230,7 +3187,7 @@ fn test_order() { assert_that( p.cargo("test").arg("--all"), - execs().with_status(0).with_stdout_contains( + execs().with_stdout_contains( " running 1 test test test_lib ... ok @@ -3271,7 +3228,7 @@ fn cyclic_dev() { .file("tests/foo.rs", "extern crate foo;") .build(); - assert_that(p.cargo("test").arg("--all"), execs().with_status(0)); + assert_that(p.cargo("test").arg("--all"), execs()); } #[test] @@ -3311,10 +3268,10 @@ fn publish_a_crate_without_tests() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("test"), execs().with_status(0)); + assert_that(p.cargo("test"), execs()); assert_that( p.cargo("test").arg("--package").arg("testless"), - execs().with_status(0), + execs(), ); } @@ -3390,7 +3347,7 @@ fn find_dependency_of_proc_macro_dependency_with_target() { .arg("--all") .arg("--target") .arg(rustc_host()), - execs().with_status(0), + execs(), ); } @@ -3474,7 +3431,7 @@ fn json_artifact_includes_test_flag() { assert_that( p.cargo("test -v --message-format=json"), - execs().with_status(0).with_json( + execs().with_json( r#" { "reason":"compiler-artifact", @@ -3545,7 +3502,7 @@ fn test_build_script_links() { assert_that( p.cargo("test --no-run"), - execs().with_status(0), + execs(), ); } @@ -3582,7 +3539,7 @@ fn doctest_skip_staticlib() { assert_that( p.cargo("test"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [COMPILING] foo [..] [FINISHED] dev [..] diff --git a/tests/testsuite/tool_paths.rs b/tests/testsuite/tool_paths.rs index c27fb1d9de1..f5710a43a10 100644 --- a/tests/testsuite/tool_paths.rs +++ b/tests/testsuite/tool_paths.rs @@ -175,7 +175,7 @@ fn custom_runner() { assert_that( p.cargo("run -- --param"), - execs().with_stderr_contains(&format!( + execs().with_status(101).with_stderr_contains(&format!( "\ [COMPILING] foo v0.0.1 ({url}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -187,7 +187,7 @@ fn custom_runner() { assert_that( p.cargo("test --test test --verbose -- --param"), - execs().with_stderr_contains(&format!( + execs().with_status(101).with_stderr_contains(&format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc [..]` @@ -200,7 +200,7 @@ fn custom_runner() { assert_that( p.cargo("bench --bench bench --verbose -- --param"), - execs().with_stderr_contains(&format!( + execs().with_status(101).with_stderr_contains(&format!( "\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc [..]` diff --git a/tests/testsuite/update.rs b/tests/testsuite/update.rs index e323fc4ff87..df480c0ef73 100644 --- a/tests/testsuite/update.rs +++ b/tests/testsuite/update.rs @@ -38,7 +38,7 @@ fn minor_update_two_places() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("log", "0.1.1").publish(); File::create(p.root().join("foo/Cargo.toml")) @@ -56,7 +56,7 @@ fn minor_update_two_places() { ) .unwrap(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -95,7 +95,7 @@ fn transitive_minor_update() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("log", "0.1.1").publish(); Package::new("serde", "0.1.1").dep("log", "0.1.1").publish(); @@ -111,7 +111,7 @@ fn transitive_minor_update() { // to change this one day. assert_that( p.cargo("update").arg("-p").arg("serde"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` ", @@ -155,14 +155,14 @@ fn conservative() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("log", "0.1.1").publish(); Package::new("serde", "0.1.1").dep("log", "0.1").publish(); assert_that( p.cargo("update").arg("-p").arg("serde"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] serde v0.1.0 -> v0.1.1 @@ -204,13 +204,13 @@ fn update_via_new_dep() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("log", "0.1.1").publish(); p.uncomment_root_manifest(); assert_that( p.cargo("build").env("RUST_LOG", "cargo=trace"), - execs().with_status(0), + execs(), ); } @@ -249,11 +249,11 @@ fn update_via_new_member() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("log", "0.1.1").publish(); p.uncomment_root_manifest(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -276,13 +276,13 @@ fn add_dep_deep_new_requirement() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("log", "0.1.1").publish(); Package::new("bar", "0.1.0").dep("log", "0.1.1").publish(); p.uncomment_root_manifest(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -306,13 +306,13 @@ fn everything_real_deep() { .file("src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("log", "0.1.1").publish(); Package::new("bar", "0.1.0").dep("log", "0.1.1").publish(); p.uncomment_root_manifest(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -348,7 +348,7 @@ fn change_package_version() { ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -387,7 +387,7 @@ fn update_precise() { .file("foo/src/lib.rs", "") .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); Package::new("serde", "0.2.0").publish(); @@ -397,7 +397,7 @@ fn update_precise() { .arg("serde:0.2.1") .arg("--precise") .arg("0.2.0"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [UPDATING] serde v0.2.1 -> v0.2.0 diff --git a/tests/testsuite/verify_project.rs b/tests/testsuite/verify_project.rs index 90c2d97dcfd..3373c26b717 100644 --- a/tests/testsuite/verify_project.rs +++ b/tests/testsuite/verify_project.rs @@ -18,7 +18,6 @@ fn cargo_verify_project_path_to_cargo_toml_relative() { .arg("foo/Cargo.toml") .cwd(p.root().parent().unwrap()), execs() - .with_status(0) .with_stdout(verify_project_success_output()), ); } @@ -36,7 +35,6 @@ fn cargo_verify_project_path_to_cargo_toml_absolute() { .arg(p.root().join("Cargo.toml")) .cwd(p.root().parent().unwrap()), execs() - .with_status(0) .with_stdout(verify_project_success_output()), ); } @@ -51,7 +49,6 @@ fn cargo_verify_project_cwd() { assert_that( p.cargo("verify-project").cwd(p.root()), execs() - .with_status(0) .with_stdout(verify_project_success_output()), ); } diff --git a/tests/testsuite/version.rs b/tests/testsuite/version.rs index 221491f194a..b6d7254fef7 100644 --- a/tests/testsuite/version.rs +++ b/tests/testsuite/version.rs @@ -9,14 +9,12 @@ fn simple() { assert_that( p.cargo("version"), execs() - .with_status(0) .with_stdout(&format!("{}\n", cargo::version())), ); assert_that( p.cargo("--version"), execs() - .with_status(0) .with_stdout(&format!("{}\n", cargo::version())), ); } @@ -25,7 +23,7 @@ fn simple() { #[cfg_attr(target_os = "windows", ignore)] fn version_works_without_rustc() { let p = project().build(); - assert_that(p.cargo("version").env("PATH", ""), execs().with_status(0)); + assert_that(p.cargo("version").env("PATH", ""), execs()); } #[test] @@ -33,7 +31,7 @@ fn version_works_with_bad_config() { let p = project() .file(".cargo/config", "this is not toml") .build(); - assert_that(p.cargo("version"), execs().with_status(0)); + assert_that(p.cargo("version"), execs()); } #[test] @@ -47,5 +45,5 @@ fn version_works_with_bad_target_dir() { "#, ) .build(); - assert_that(p.cargo("version"), execs().with_status(0)); + assert_that(p.cargo("version"), execs()); } diff --git a/tests/testsuite/warn_on_failure.rs b/tests/testsuite/warn_on_failure.rs index c36499f8b90..baf9035e91f 100644 --- a/tests/testsuite/warn_on_failure.rs +++ b/tests/testsuite/warn_on_failure.rs @@ -60,7 +60,7 @@ fn no_warning_on_success() { let upstream = make_upstream(""); assert_that( upstream.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] bar v0.0.1 ([..]) diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index 95c47f46461..4cbfccc3f8f 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -36,13 +36,13 @@ fn simple_explicit() { .file("bar/src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), is_not(existing_file())); assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); @@ -81,7 +81,7 @@ fn simple_explicit_default_members() { .file("bar/src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("bar"), existing_file()); assert_that(&p.bin("foo"), is_not(existing_file())); } @@ -106,13 +106,13 @@ fn inferred_root() { .file("bar/src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), is_not(existing_file())); assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); @@ -144,13 +144,13 @@ fn inferred_path_dep() { .file("bar/src/lib.rs", ""); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), is_not(existing_file())); assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); @@ -196,14 +196,14 @@ fn transitive_path_dep() { .file("baz/src/lib.rs", ""); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), is_not(existing_file())); assert_that(&p.bin("baz"), is_not(existing_file())); assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); @@ -211,7 +211,7 @@ fn transitive_path_dep() { assert_that( p.cargo("build").cwd(p.root().join("baz")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); @@ -256,11 +256,11 @@ fn parent_pointer_works() { assert_that( p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("foo/Cargo.lock"), existing_file()); assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file())); @@ -417,7 +417,7 @@ fn bare_workspace_ok() { .file("src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -610,7 +610,7 @@ fn share_dependencies() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] dep1 v0.1.3 ([..]) @@ -657,7 +657,7 @@ fn fetch_fetches_all() { assert_that( p.cargo("fetch"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [UPDATING] registry `[..]` [DOWNLOADING] dep1 v0.1.3 ([..]) @@ -705,9 +705,7 @@ fn lock_works_for_everyone() { assert_that( p.cargo("generate-lockfile"), - execs() - .with_status(0) - .with_stderr("[UPDATING] registry `[..]`"), + execs().with_stderr("[UPDATING] registry `[..]`"), ); Package::new("dep1", "0.1.1").publish(); @@ -715,7 +713,7 @@ fn lock_works_for_everyone() { assert_that( p.cargo("build"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [DOWNLOADING] dep2 v0.1.0 ([..]) [COMPILING] dep2 v0.1.0 @@ -727,7 +725,7 @@ fn lock_works_for_everyone() { assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [DOWNLOADING] dep1 v0.1.0 ([..]) [COMPILING] dep1 v0.1.0 @@ -753,7 +751,7 @@ fn virtual_works() { let p = p.build(); assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("Cargo.lock"), existing_file()); assert_that(&p.bin("bar"), existing_file()); @@ -775,7 +773,7 @@ fn explicit_package_argument_works_with_virtual_manifest() { let p = p.build(); assert_that( p.cargo("build --package bar").cwd(p.root()), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("Cargo.lock"), existing_file()); assert_that(&p.bin("bar"), existing_file()); @@ -822,7 +820,7 @@ fn virtual_build_all_implied() { .file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0")) .file("bar/src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -841,7 +839,7 @@ fn virtual_default_members() { .file("bar/src/main.rs", "fn main() {}") .file("baz/src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("bar"), existing_file()); assert_that(&p.bin("baz"), is_not(existing_file())); } @@ -965,17 +963,17 @@ fn members_include_path_deps() { assert_that( p.cargo("build").cwd(p.root().join("p1")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").cwd(p.root().join("p2")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").cwd(p.root().join("p3")), - execs().with_status(0), + execs(), ); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.root().join("target"), existing_dir()); assert_that(&p.root().join("p1/target"), is_not(existing_dir())); @@ -1002,7 +1000,7 @@ fn new_warns_you_this_will_not_work() { assert_that( p.cargo("new").arg("--lib").arg("bar").env("USER", "foo"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ warning: compiling this new crate may not work due to invalid workspace \ configuration @@ -1056,14 +1054,14 @@ fn lock_doesnt_change_depending_on_crate() { Package::new("foo", "1.0.0").publish(); Package::new("bar", "1.0.0").publish(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let mut lockfile = String::new(); t!(t!(File::open(p.root().join("Cargo.lock"))).read_to_string(&mut lockfile)); assert_that( p.cargo("build").cwd(p.root().join("baz")), - execs().with_status(0), + execs(), ); let mut lockfile2 = String::new(); @@ -1114,7 +1112,7 @@ fn rebuild_please() { assert_that( p.cargo("run").cwd(p.root().join("bin")), - execs().with_status(0), + execs(), ); sleep_ms(1000); @@ -1125,7 +1123,7 @@ fn rebuild_please() { assert_that( p.cargo("build").cwd(p.root().join("lib")), - execs().with_status(0), + execs(), ); assert_that( @@ -1171,7 +1169,7 @@ fn workspace_in_git() { ); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); } #[test] @@ -1203,7 +1201,7 @@ fn lockfile_can_specify_nonexistant_members() { assert_that( p.cargo("build").cwd(p.root().join("a")), - execs().with_status(0), + execs(), ); } @@ -1276,7 +1274,7 @@ fn workspace_with_transitive_dev_deps() { .file("baz/src/lib.rs", r#"pub fn do_stuff() {}"#); let p = p.build(); - assert_that(p.cargo("test -p bar"), execs().with_status(0)); + assert_that(p.cargo("test -p bar"), execs()); } #[test] @@ -1326,11 +1324,11 @@ fn relative_path_for_member_works() { assert_that( p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0), + execs(), ); assert_that( p.cargo("build").cwd(p.root().join("bar")), - execs().with_status(0), + execs(), ); } @@ -1361,7 +1359,7 @@ fn relative_path_for_root_works() { .cwd(p.root()) .arg("--manifest-path") .arg("./Cargo.toml"), - execs().with_status(0), + execs(), ); assert_that( @@ -1369,7 +1367,7 @@ fn relative_path_for_root_works() { .cwd(p.root().join("subproj")) .arg("--manifest-path") .arg("../Cargo.toml"), - execs().with_status(0), + execs(), ); } @@ -1398,7 +1396,7 @@ fn path_dep_outside_workspace_is_not_member() { assert_that( p.cargo("build").cwd(p.root().join("ws")), - execs().with_status(0), + execs(), ); } @@ -1450,7 +1448,7 @@ fn test_in_and_out_of_workspace() { assert_that( p.cargo("build").cwd(p.root().join("ws")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("ws/Cargo.lock"), existing_file()); @@ -1462,7 +1460,7 @@ fn test_in_and_out_of_workspace() { assert_that( p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("foo/Cargo.lock"), existing_file()); assert_that(&p.root().join("foo/target"), existing_dir()); @@ -1508,7 +1506,7 @@ fn test_path_dependency_under_member() { assert_that( p.cargo("build").cwd(p.root().join("ws")), - execs().with_status(0), + execs(), ); assert_that( @@ -1519,7 +1517,7 @@ fn test_path_dependency_under_member() { assert_that( p.cargo("build").cwd(p.root().join("foo/bar")), - execs().with_status(0), + execs(), ); assert_that( @@ -1549,11 +1547,11 @@ fn excluded_simple() { .file("foo/src/lib.rs", ""); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.root().join("target"), existing_dir()); assert_that( p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("foo/target"), existing_dir()); } @@ -1581,16 +1579,16 @@ fn exclude_members_preferred() { .file("foo/bar/src/lib.rs", ""); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.root().join("target"), existing_dir()); assert_that( p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("foo/target"), existing_dir()); assert_that( p.cargo("build").cwd(p.root().join("foo/bar")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("foo/bar/target"), is_not(existing_dir())); } @@ -1620,16 +1618,16 @@ fn exclude_but_also_depend() { .file("foo/bar/src/lib.rs", ""); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.root().join("target"), existing_dir()); assert_that( p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("foo/target"), existing_dir()); assert_that( p.cargo("build").cwd(p.root().join("foo/bar")), - execs().with_status(0), + execs(), ); assert_that(&p.root().join("foo/bar/target"), existing_dir()); } @@ -1673,28 +1671,28 @@ fn glob_syntax() { .file("crates/qux/src/main.rs", "fn main() {}"); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), is_not(existing_file())); assert_that(&p.bin("baz"), is_not(existing_file())); assert_that( p.cargo("build").cwd(p.root().join("crates/bar")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); assert_that( p.cargo("build").cwd(p.root().join("crates/baz")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("baz"), existing_file()); assert_that( p.cargo("build").cwd(p.root().join("crates/qux")), - execs().with_status(0), + execs(), ); assert_that(&p.bin("qux"), is_not(existing_file())); @@ -1750,23 +1748,23 @@ fn glob_syntax_2() { .file("crates/qux/src/main.rs", "fn main() {}"); p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), is_not(existing_file())); assert_that(&p.bin("baz"), is_not(existing_file())); assert_that(p.cargo("build").cwd(p.root().join("crates/bar")), - execs().with_status(0)); + execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("bar"), existing_file()); assert_that(p.cargo("build").cwd(p.root().join("crates/baz")), - execs().with_status(0)); + execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(&p.bin("baz"), existing_file()); assert_that(p.cargo("build").cwd(p.root().join("crates/qux")), - execs().with_status(0)); + execs()); assert_that(&p.bin("qux"), is_not(existing_file())); assert_that(&p.root().join("Cargo.lock"), existing_file()); @@ -1870,7 +1868,7 @@ fn dep_used_with_separate_features() { // Build the entire workspace assert_that( p.cargo("build").arg("--all"), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..]Compiling feat_lib v0.1.0 ([..]) [..]Compiling caller1 v0.1.0 ([..]) @@ -1888,7 +1886,7 @@ fn dep_used_with_separate_features() { // a single cargo build at the top level will be enough. assert_that( p.cargo("build").cwd(p.root().join("caller1")), - execs().with_status(0).with_stderr( + execs().with_stderr( "\ [..]Compiling feat_lib v0.1.0 ([..]) [..]Compiling caller1 v0.1.0 ([..]) @@ -1902,19 +1900,16 @@ fn dep_used_with_separate_features() { assert_that( p.cargo("build").cwd(p.root().join("caller2")), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("build").cwd(p.root().join("caller1")), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); assert_that( p.cargo("build").cwd(p.root().join("caller2")), execs() - .with_status(0) .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"), ); } @@ -1970,7 +1965,7 @@ fn dont_recurse_out_of_cargo_home() { assert_that( p.cargo("build").env("CARGO_HOME", p.root().join(".cargo")), - execs().with_status(0), + execs(), ); } @@ -1990,11 +1985,11 @@ fn include_and_exclude() { p.build(); assert_that(p.cargo("build").cwd(p.root().join("foo")), - execs().with_status(0)); + execs()); assert_that(&p.root().join("target"), existing_dir()); assert_that(&p.root().join("foo/target"), is_not(existing_dir())); assert_that(p.cargo("build").cwd(p.root().join("foo/bar")), - execs().with_status(0)); + execs()); assert_that(&p.root().join("foo/bar/target"), existing_dir()); } */ @@ -2018,10 +2013,10 @@ fn cargo_home_at_root_works() { .file("a/src/lib.rs", ""); let p = p.build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); assert_that( p.cargo("build").arg("--frozen").env("CARGO_HOME", p.root()), - execs().with_status(0), + execs(), ); } @@ -2044,7 +2039,7 @@ fn relative_rustc() { "#, ) .build(); - assert_that(p.cargo("build"), execs().with_status(0)); + assert_that(p.cargo("build"), execs()); let src = p.root() .join("target/debug/foo") @@ -2070,7 +2065,7 @@ fn relative_rustc() { fs::copy(&src, p.root().join(src.file_name().unwrap())).unwrap(); let file = format!("./foo{}", env::consts::EXE_SUFFIX); - assert_that(p.cargo("build").env("RUSTC", &file), execs().with_status(0)); + assert_that(p.cargo("build").env("RUSTC", &file), execs()); }