Skip to content

Commit

Permalink
Auto merge of #13756 - dtolnay-contrib:testdoc, r=weihanglo
Browse files Browse the repository at this point in the history
Recategorize cargo test's `--doc` flag under "Target Selection"

### What does this PR try to resolve?

In `cargo help test`, the `--doc` flag is listed under a section called "Target Selection" next to `--lib`, `--bin`, `--bins`, `--example`, `--examples`, `--test`, `--tests`, `--bench`, `--benches`, and `--all-targets`.

But in `cargo test --help`, it was instead listed in an "Options" section next to `--no-run`, `--message-format`, `--color`, etc, which seems less appropriate than "Target Selection".

### How should we test and review this PR?

- `cargo build --release`
- `cargo test --release --test testsuite -- cargo_test::help::case`
- `target/release/cargo test --help`
- `target/release/cargo help test` (unchanged)
  • Loading branch information
bors committed Apr 15, 2024
2 parents 07ac23a + afea119 commit a9f86ad
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
5 changes: 4 additions & 1 deletion src/bin/cargo/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub fn cli() -> Command {
.num_args(0..)
.last(true),
)
.arg(flag("doc", "Test only this library's documentation"))
.arg(flag("no-run", "Compile, but don't run tests"))
.arg(flag("no-fail-fast", "Run all tests regardless of failure"))
.arg_future_incompat_report()
Expand Down Expand Up @@ -47,6 +46,10 @@ pub fn cli() -> Command {
"Test all bench targets",
"Test all targets (does not include doctests)",
)
.arg(
flag("doc", "Test only this library's documentation")
.help_heading(heading::TARGET_SELECTION),
)
.arg_features()
.arg_jobs()
.arg_unsupported_keep_going()
Expand Down
60 changes: 30 additions & 30 deletions tests/testsuite/cargo_test/help/stdout.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a9f86ad

Please sign in to comment.