Skip to content

Commit 4e79892

Browse files
committed
WIP: test(cli): Track --help output
This makes it easier to evaluate the usability of PRs
1 parent 6feea34 commit 4e79892

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use cargo_test_support::curr_dir;
2+
use cargo_test_support::prelude::*;
3+
4+
#[cargo_test]
5+
fn case() {
6+
snapbox::cmd::Command::cargo_ui()
7+
.arg("build")
8+
.arg("--help")
9+
.assert()
10+
.success()
11+
.stdout_matches_path(curr_dir!().join("stdout.log"))
12+
.stderr_matches_path(curr_dir!().join("stderr.log"));
13+
}

tests/testsuite/cargo_build/help/stderr.log

Whitespace-only changes.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Compile a local package and all of its dependencies
2+
3+
Usage: cargo build [OPTIONS]
4+
5+
Options:
6+
-q, --quiet Do not print cargo log messages
7+
-p, --package [<SPEC>] Package to build (see `cargo help pkgid`)
8+
--workspace Build all packages in the workspace
9+
--exclude <SPEC> Exclude packages from the build
10+
-v, --verbose... Use verbose output (-vv very verbose/build.rs output)
11+
--all Alias for --workspace (deprecated)
12+
--color <WHEN> Coloring: auto, always, never
13+
-j, --jobs <N> Number of parallel jobs, defaults to # of CPUs
14+
--keep-going Do not abort the build as soon as there is an error (unstable)
15+
--frozen Require Cargo.lock and cache are up to date
16+
--lib Build only this package's library
17+
--bin [<NAME>] Build only the specified binary
18+
--locked Require Cargo.lock is up to date
19+
--bins Build all binaries
20+
--offline Run without accessing the network
21+
--config <KEY=VALUE> Override a configuration value
22+
--example [<NAME>] Build only the specified example
23+
--examples Build all examples
24+
-Z <FLAG> Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
25+
--test [<NAME>] Build only the specified test target
26+
--tests Build all tests
27+
--bench [<NAME>] Build only the specified bench target
28+
--benches Build all benches
29+
--all-targets Build all targets
30+
-r, --release Build artifacts in release mode, with optimizations
31+
--profile <PROFILE-NAME> Build artifacts with the specified profile
32+
-F, --features <FEATURES> Space or comma separated list of features to activate
33+
--all-features Activate all available features
34+
--no-default-features Do not activate the `default` feature
35+
--target <TRIPLE> Build for the target triple
36+
--target-dir <DIRECTORY> Directory for all generated artifacts
37+
--out-dir <PATH> Copy final artifacts to this directory (unstable)
38+
--manifest-path <PATH> Path to Cargo.toml
39+
--ignore-rust-version Ignore `rust-version` specification in packages
40+
--message-format <FMT> Error format
41+
--build-plan Output the build plan in JSON (unstable)
42+
--unit-graph Output build graph in JSON (unstable)
43+
--future-incompat-report Outputs a future incompatibility report at the end of the build
44+
--timings[=<FMTS>] Timing output formats (unstable) (comma separated): html, json
45+
-h, --help Print help
46+
47+
Run `cargo help build` for more detailed information.

tests/testsuite/cargo_build/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod help;

tests/testsuite/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ mod build_script_extra_link_arg;
2020
mod cache_messages;
2121
mod cargo_add;
2222
mod cargo_alias_config;
23+
mod cargo_build;
2324
mod cargo_command;
2425
mod cargo_config;
2526
mod cargo_env_config;

0 commit comments

Comments
 (0)