diff --git a/tests/testsuite/bench.rs b/tests/testsuite/bench.rs index 6b09d47eb5f6..01017e85762c 100644 --- a/tests/testsuite/bench.rs +++ b/tests/testsuite/bench.rs @@ -1671,29 +1671,6 @@ fn json_artifact_includes_executable_for_benchmark() { .run(); } -#[cargo_test] -fn cargo_bench_no_keep_going() { - let p = project() - .file("Cargo.toml", &basic_bin_manifest("foo")) - .file("src/main.rs", "") - .build(); - - p.cargo("bench --keep-going") - .with_stderr( - "\ -error: unexpected argument '--keep-going' found - - tip: use `--no-fail-fast` to run as many tests as possible regardless of failure - -Usage: cargo bench [OPTIONS] [BENCHNAME] [-- [args]...] - -For more information, try '--help'. -", - ) - .with_status(1) - .run(); -} - #[cargo_test(nightly, reason = "bench")] fn cargo_bench_print_env_verbose() { let p = project() diff --git a/tests/testsuite/cargo_bench/mod.rs b/tests/testsuite/cargo_bench/mod.rs index c0ce11180711..28be9d1a7c5f 100644 --- a/tests/testsuite/cargo_bench/mod.rs +++ b/tests/testsuite/cargo_bench/mod.rs @@ -1 +1,2 @@ mod help; +mod no_keep_going; diff --git a/tests/testsuite/cargo_bench/no_keep_going/in/Cargo.toml b/tests/testsuite/cargo_bench/no_keep_going/in/Cargo.toml new file mode 100644 index 000000000000..c35d63273aa7 --- /dev/null +++ b/tests/testsuite/cargo_bench/no_keep_going/in/Cargo.toml @@ -0,0 +1,3 @@ +[package] +name = "foo" +version = "0.1.0" diff --git a/tests/testsuite/cargo_bench/no_keep_going/in/src/lib.rs b/tests/testsuite/cargo_bench/no_keep_going/in/src/lib.rs new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_bench/no_keep_going/mod.rs b/tests/testsuite/cargo_bench/no_keep_going/mod.rs new file mode 100644 index 000000000000..6ed5f81f9768 --- /dev/null +++ b/tests/testsuite/cargo_bench/no_keep_going/mod.rs @@ -0,0 +1,19 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("bench") + .arg("--keep-going") + .current_dir(cwd) + .assert() + .code(1) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/tests/testsuite/cargo_bench/no_keep_going/stderr.log b/tests/testsuite/cargo_bench/no_keep_going/stderr.log new file mode 100644 index 000000000000..8e8f1c034b80 --- /dev/null +++ b/tests/testsuite/cargo_bench/no_keep_going/stderr.log @@ -0,0 +1,7 @@ +error: unexpected argument '--keep-going' found + + tip: use `--no-fail-fast` to run as many tests as possible regardless of failure + +Usage: cargo bench [OPTIONS] [BENCHNAME] [-- [args]...] + +For more information, try '--help'. diff --git a/tests/testsuite/cargo_bench/no_keep_going/stdout.log b/tests/testsuite/cargo_bench/no_keep_going/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_test/mod.rs b/tests/testsuite/cargo_test/mod.rs index c0ce11180711..28be9d1a7c5f 100644 --- a/tests/testsuite/cargo_test/mod.rs +++ b/tests/testsuite/cargo_test/mod.rs @@ -1 +1,2 @@ mod help; +mod no_keep_going; diff --git a/tests/testsuite/cargo_test/no_keep_going/in/Cargo.toml b/tests/testsuite/cargo_test/no_keep_going/in/Cargo.toml new file mode 100644 index 000000000000..c35d63273aa7 --- /dev/null +++ b/tests/testsuite/cargo_test/no_keep_going/in/Cargo.toml @@ -0,0 +1,3 @@ +[package] +name = "foo" +version = "0.1.0" diff --git a/tests/testsuite/cargo_test/no_keep_going/in/src/lib.rs b/tests/testsuite/cargo_test/no_keep_going/in/src/lib.rs new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/cargo_test/no_keep_going/mod.rs b/tests/testsuite/cargo_test/no_keep_going/mod.rs new file mode 100644 index 000000000000..fdec61642359 --- /dev/null +++ b/tests/testsuite/cargo_test/no_keep_going/mod.rs @@ -0,0 +1,19 @@ +use cargo_test_support::curr_dir; +use cargo_test_support::CargoCommand; +use cargo_test_support::Project; + +#[cargo_test] +fn case() { + let project = Project::from_template(curr_dir!().join("in")); + let project_root = project.root(); + let cwd = &project_root; + + snapbox::cmd::Command::cargo_ui() + .arg("test") + .arg("--keep-going") + .current_dir(cwd) + .assert() + .code(1) + .stdout_matches_path(curr_dir!().join("stdout.log")) + .stderr_matches_path(curr_dir!().join("stderr.log")); +} diff --git a/tests/testsuite/cargo_test/no_keep_going/stderr.log b/tests/testsuite/cargo_test/no_keep_going/stderr.log new file mode 100644 index 000000000000..5772505b6741 --- /dev/null +++ b/tests/testsuite/cargo_test/no_keep_going/stderr.log @@ -0,0 +1,7 @@ +error: unexpected argument '--keep-going' found + + tip: use `--no-fail-fast` to run as many tests as possible regardless of failure + +Usage: cargo test [OPTIONS] [TESTNAME] [-- [args]...] + +For more information, try '--help'. diff --git a/tests/testsuite/cargo_test/no_keep_going/stdout.log b/tests/testsuite/cargo_test/no_keep_going/stdout.log new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 758bfe09c582..5f6528109bee 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -4844,29 +4844,6 @@ error: 2 targets failed: .run(); } -#[cargo_test] -fn cargo_test_no_keep_going() { - let p = project() - .file("Cargo.toml", &basic_bin_manifest("foo")) - .file("src/main.rs", "") - .build(); - - p.cargo("test --keep-going") - .with_stderr( - "\ -error: unexpected argument '--keep-going' found - - tip: use `--no-fail-fast` to run as many tests as possible regardless of failure - -Usage: cargo test [OPTIONS] [TESTNAME] [-- [args]...] - -For more information, try '--help'. -", - ) - .with_status(1) - .run(); -} - #[cargo_test] fn cargo_test_print_env_verbose() { let p = project()