Skip to content

Commit eaa902f

Browse files
committed
test: move --keep-going suggestion match tests to UI tests
We don't want to overly match to suggestion help from clap.
1 parent b456bd2 commit eaa902f

File tree

14 files changed

+62
-48
lines changed

14 files changed

+62
-48
lines changed

tests/testsuite/bench.rs

-24
Original file line numberDiff line numberDiff line change
@@ -1671,30 +1671,6 @@ fn json_artifact_includes_executable_for_benchmark() {
16711671
.run();
16721672
}
16731673

1674-
#[cargo_test]
1675-
fn cargo_bench_no_keep_going() {
1676-
let p = project()
1677-
.file("Cargo.toml", &basic_bin_manifest("foo"))
1678-
.file("src/main.rs", "")
1679-
.build();
1680-
1681-
p.cargo("bench --keep-going")
1682-
.with_stderr(
1683-
"\
1684-
error: unexpected argument '--keep-going' found
1685-
1686-
tip: a similar argument exists: '--no-fail-fast'
1687-
tip: use `--no-fail-fast` to run as many tests as possible regardless of failure
1688-
1689-
Usage: cargo bench [OPTIONS] [BENCHNAME] [-- [args]...]
1690-
1691-
For more information, try '--help'.
1692-
",
1693-
)
1694-
.with_status(1)
1695-
.run();
1696-
}
1697-
16981674
#[cargo_test(nightly, reason = "bench")]
16991675
fn cargo_bench_print_env_verbose() {
17001676
let p = project()

tests/testsuite/cargo_bench/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
mod help;
2+
mod no_keep_going;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[package]
2+
name = "foo"
3+
version = "0.1.0"

tests/testsuite/cargo_bench/no_keep_going/in/src/lib.rs

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use cargo_test_support::curr_dir;
2+
use cargo_test_support::CargoCommand;
3+
use cargo_test_support::Project;
4+
5+
#[cargo_test]
6+
fn case() {
7+
let project = Project::from_template(curr_dir!().join("in"));
8+
let project_root = project.root();
9+
let cwd = &project_root;
10+
11+
snapbox::cmd::Command::cargo_ui()
12+
.arg("bench")
13+
.arg("--keep-going")
14+
.current_dir(cwd)
15+
.assert()
16+
.code(1)
17+
.stdout_matches_path(curr_dir!().join("stdout.log"))
18+
.stderr_matches_path(curr_dir!().join("stderr.log"));
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: unexpected argument '--keep-going' found
2+
3+
tip: a similar argument exists: '--no-fail-fast'
4+
tip: use `--no-fail-fast` to run as many tests as possible regardless of failure
5+
6+
Usage: cargo bench [OPTIONS] [BENCHNAME] [-- [args]...]
7+
8+
For more information, try '--help'.

tests/testsuite/cargo_bench/no_keep_going/stdout.log

Whitespace-only changes.

tests/testsuite/cargo_test/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
mod help;
2+
mod no_keep_going;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[package]
2+
name = "foo"
3+
version = "0.1.0"

tests/testsuite/cargo_test/no_keep_going/in/src/lib.rs

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use cargo_test_support::curr_dir;
2+
use cargo_test_support::CargoCommand;
3+
use cargo_test_support::Project;
4+
5+
#[cargo_test]
6+
fn case() {
7+
let project = Project::from_template(curr_dir!().join("in"));
8+
let project_root = project.root();
9+
let cwd = &project_root;
10+
11+
snapbox::cmd::Command::cargo_ui()
12+
.arg("test")
13+
.arg("--keep-going")
14+
.current_dir(cwd)
15+
.assert()
16+
.code(1)
17+
.stdout_matches_path(curr_dir!().join("stdout.log"))
18+
.stderr_matches_path(curr_dir!().join("stderr.log"));
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: unexpected argument '--keep-going' found
2+
3+
tip: a similar argument exists: '--no-fail-fast'
4+
tip: use `--no-fail-fast` to run as many tests as possible regardless of failure
5+
6+
Usage: cargo test [OPTIONS] [TESTNAME] [-- [args]...]
7+
8+
For more information, try '--help'.

tests/testsuite/cargo_test/no_keep_going/stdout.log

Whitespace-only changes.

tests/testsuite/test.rs

-24
Original file line numberDiff line numberDiff line change
@@ -4844,30 +4844,6 @@ error: 2 targets failed:
48444844
.run();
48454845
}
48464846

4847-
#[cargo_test]
4848-
fn cargo_test_no_keep_going() {
4849-
let p = project()
4850-
.file("Cargo.toml", &basic_bin_manifest("foo"))
4851-
.file("src/main.rs", "")
4852-
.build();
4853-
4854-
p.cargo("test --keep-going")
4855-
.with_stderr(
4856-
"\
4857-
error: unexpected argument '--keep-going' found
4858-
4859-
tip: a similar argument exists: '--no-fail-fast'
4860-
tip: use `--no-fail-fast` to run as many tests as possible regardless of failure
4861-
4862-
Usage: cargo test [OPTIONS] [TESTNAME] [-- [args]...]
4863-
4864-
For more information, try '--help'.
4865-
",
4866-
)
4867-
.with_status(1)
4868-
.run();
4869-
}
4870-
48714847
#[cargo_test]
48724848
fn cargo_test_print_env_verbose() {
48734849
let p = project()

0 commit comments

Comments
 (0)