Skip to content

Commit

Permalink
Auto merge of rust-lang#12915 - epage:test-targets, r=weihanglo
Browse files Browse the repository at this point in the history
fix(cli): Clarify --test is for targets, not test functions

We already refer to test targets as "test targets" instead of "tests" in `--test` but not `--tests` or in the error output.  This makes it uniformly refer to them as "test targets", making it clearer that these aren't test functions.

Fixes rust-lang#7864
  • Loading branch information
bors committed Nov 3, 2023
2 parents 0fe3257 + 76918a0 commit 65e297d
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ pub fn cli() -> Command {
"Benchmark only the specified example",
"Benchmark all examples",
"Benchmark only the specified test target",
"Benchmark all tests",
"Benchmark all test targets",
"Benchmark only the specified bench target",
"Benchmark all benches",
"Benchmark all bench targets",
"Benchmark all targets",
)
.arg_features()
Expand Down
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub fn cli() -> Command {
"Build only the specified example",
"Build all examples",
"Build only the specified test target",
"Build all tests",
"Build all test targets",
"Build only the specified bench target",
"Build all benches",
"Build all bench targets",
"Build all targets",
)
.arg_features()
Expand Down
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub fn cli() -> Command {
"Check only the specified example",
"Check all examples",
"Check only the specified test target",
"Check all tests",
"Check all test targets",
"Check only the specified bench target",
"Check all benches",
"Check all bench targets",
"Check all targets",
)
.arg_features()
Expand Down
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ pub fn cli() -> Command {
"Fix only the specified example",
"Fix all examples",
"Fix only the specified test target",
"Fix all tests",
"Fix all test targets",
"Fix only the specified bench target",
"Fix all benches",
"Fix all bench targets",
"Fix all targets (default)",
)
.arg_features()
Expand Down
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ pub fn cli() -> Command {
"Build only the specified example",
"Build all examples",
"Build only the specified test target",
"Build all tests",
"Build all test targets",
"Build only the specified bench target",
"Build all benches",
"Build all bench targets",
"Build all targets",
)
.arg_features()
Expand Down
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ pub fn cli() -> Command {
"Build only the specified example",
"Build all examples",
"Build only the specified test target",
"Build all tests",
"Build all test targets",
"Build only the specified bench target",
"Build all benches",
"Build all bench targets",
"Build all targets",
)
.arg_features()
Expand Down
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ pub fn cli() -> Command {
"Test only the specified example",
"Test all examples",
"Test only the specified test target",
"Test all tests",
"Test all test targets",
"Test only the specified bench target",
"Test all benches",
"Test all bench targets",
"Test all targets (does not include doctests)",
)
.arg_features()
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/util/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ pub fn print_available_binaries(ws: &Workspace<'_>, options: &CompileOptions) ->
}

pub fn print_available_benches(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> {
print_available_targets(Target::is_bench, ws, options, "--bench", "benches")
print_available_targets(Target::is_bench, ws, options, "--bench", "bench targets")
}

pub fn print_available_tests(ws: &Workspace<'_>, options: &CompileOptions) -> CargoResult<()> {
print_available_targets(Target::is_test, ws, options, "--test", "tests")
print_available_targets(Target::is_test, ws, options, "--test", "test targets")
}

/// The path that we pass to rustc is actually fairly important because it will
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_bench/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Target Selection:
--bin [<NAME>] Benchmark only the specified binary
--examples Benchmark all examples
--example [<NAME>] Benchmark only the specified example
--tests Benchmark all tests
--tests Benchmark all test targets
--test [<NAME>] Benchmark only the specified test target
--benches Benchmark all benches
--benches Benchmark all bench targets
--bench [<NAME>] Benchmark only the specified bench target
--all-targets Benchmark all targets

Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_build/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Target Selection:
--bin [<NAME>] Build only the specified binary
--examples Build all examples
--example [<NAME>] Build only the specified example
--tests Build all tests
--tests Build all test targets
--test [<NAME>] Build only the specified test target
--benches Build all benches
--benches Build all bench targets
--bench [<NAME>] Build only the specified bench target
--all-targets Build all targets

Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_check/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Target Selection:
--bin [<NAME>] Check only the specified binary
--examples Check all examples
--example [<NAME>] Check only the specified example
--tests Check all tests
--tests Check all test targets
--test [<NAME>] Check only the specified test target
--benches Check all benches
--benches Check all bench targets
--bench [<NAME>] Check only the specified bench target
--all-targets Check all targets

Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_fix/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Target Selection:
--bin [<NAME>] Fix only the specified binary
--examples Fix all examples
--example [<NAME>] Fix only the specified example
--tests Fix all tests
--tests Fix all test targets
--test [<NAME>] Fix only the specified test target
--benches Fix all benches
--benches Fix all bench targets
--bench [<NAME>] Fix only the specified bench target
--all-targets Fix all targets (default)

Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_rustc/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Target Selection:
--bin [<NAME>] Build only the specified binary
--examples Build all examples
--example [<NAME>] Build only the specified example
--tests Build all tests
--tests Build all test targets
--test [<NAME>] Build only the specified test target
--benches Build all benches
--benches Build all bench targets
--bench [<NAME>] Build only the specified bench target
--all-targets Build all targets

Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_rustdoc/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Target Selection:
--bin [<NAME>] Build only the specified binary
--examples Build all examples
--example [<NAME>] Build only the specified example
--tests Build all tests
--tests Build all test targets
--test [<NAME>] Build only the specified test target
--benches Build all benches
--benches Build all bench targets
--bench [<NAME>] Build only the specified bench target
--all-targets Build all targets

Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cargo_test/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Target Selection:
--bin [<NAME>] Test only the specified binary
--examples Test all examples
--example [<NAME>] Test only the specified example
--tests Test all tests
--tests Test all test targets
--test [<NAME>] Test only the specified test target
--benches Test all benches
--benches Test all bench targets
--bench [<NAME>] Test only the specified bench target
--all-targets Test all targets (does not include doctests)

Expand Down
8 changes: 4 additions & 4 deletions tests/testsuite/list_availables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Available binaries:
.with_stderr(
"\
error: \"--bench\" takes one argument.
Available benches:
Available bench targets:
bench1
bench2
Expand All @@ -75,7 +75,7 @@ Available benches:
.with_stderr(
"\
error: \"--test\" takes one argument.
Available tests:
Available test targets:
test1
test2
Expand Down Expand Up @@ -139,7 +139,7 @@ No binaries available.
.with_stderr(
"\
error: \"--bench\" takes one argument.
No benches available.
No bench targets available.
",
)
Expand All @@ -153,7 +153,7 @@ No benches available.
.with_stderr(
"\
error: \"--test\" takes one argument.
No tests available.
No test targets available.
",
)
Expand Down

0 comments on commit 65e297d

Please sign in to comment.