Skip to content

Commit 3d4407d

Browse files
committed
test(cli): snapshot test for -Z help
1 parent 13e9792 commit 3d4407d

File tree

5 files changed

+51
-11
lines changed

5 files changed

+51
-11
lines changed

tests/testsuite/cargo/mod.rs

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

tests/testsuite/cargo/z_help/mod.rs

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+
.masquerade_as_nightly_cargo(&["-Z help"])
8+
.args(["-Z", "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/z_help/stderr.log

Whitespace-only changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Available unstable (nightly-only) flags:
3+
4+
-Z allow-features -- Allow *only* the listed unstable features
5+
-Z asymmetric-token -- Allows authenticating with asymmetric tokens
6+
-Z avoid-dev-deps -- Avoid installing dev-dependencies if possible
7+
-Z binary-dep-depinfo -- Track changes to dependency artifacts
8+
-Z bindeps -- Allow Cargo packages to depend on bin, cdylib, and staticlib crates, and use the artifacts built by those crates
9+
-Z build-std -- Enable Cargo to compile the standard library itself as part of a crate graph compilation
10+
-Z build-std-features -- Configure features enabled for the standard library itself when building the standard library
11+
-Z check-cfg -- Enable compile-time checking of `cfg` names/values/features
12+
-Z codegen-backend -- Enable the `codegen-backend` option in profiles in .cargo/config.toml file
13+
-Z config-include -- Enable the `include` key in config files
14+
-Z direct-minimal-versions -- Resolve minimal dependency versions instead of maximum (direct dependencies only)
15+
-Z doctest-xcompile -- Compile and run doctests for non-host target using runner config
16+
-Z dual-proc-macros -- Build proc-macros for both the host and the target
17+
-Z gc -- Track cache usage and "garbage collect" unused files
18+
-Z gitoxide -- Use gitoxide for the given git interactions, or all of them if no argument is given
19+
-Z host-config -- Enable the [host] section in the .cargo/config.toml file
20+
-Z lints -- Pass `[lints]` to the linting tools
21+
-Z minimal-versions -- Resolve minimal dependency versions instead of maximum
22+
-Z msrv-policy -- Enable rust-version aware policy within cargo
23+
-Z mtime-on-use -- Configure Cargo to update the mtime of used files
24+
-Z no-index-update -- Do not update the registry index even if the cache is outdated
25+
-Z panic-abort-tests -- Enable support to run tests with -Cpanic=abort
26+
-Z profile-rustflags -- Enable the `rustflags` option in profiles in .cargo/config.toml file
27+
-Z publish-timeout -- Enable the `publish.timeout` key in .cargo/config.toml file
28+
-Z rustdoc-map -- Allow passing external documentation mappings to rustdoc
29+
-Z rustdoc-scrape-examples -- Allows Rustdoc to scrape code examples from reverse-dependencies
30+
-Z script -- Enable support for single-file, `.rs` packages
31+
-Z target-applies-to-host -- Enable the `target-applies-to-host` key in the .cargo/config.toml file
32+
-Z trim-paths -- Enable the `trim-paths` option in profiles
33+
-Z unstable-options -- Allow the usage of unstable options
34+
35+
Run with 'cargo -Z [FLAG] [COMMAND]'
36+
37+
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information about these flags.

tests/testsuite/help.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ fn help_external_subcommand() {
4343
.run();
4444
}
4545

46-
#[cargo_test]
47-
fn z_flags_help() {
48-
// Test that the output of `cargo -Z help` shows a different help screen with
49-
// all the `-Z` flags.
50-
cargo_process("-Z help")
51-
.with_stdout_contains(
52-
" -Z allow-features[..]-- Allow *only* the listed unstable features",
53-
)
54-
.run();
55-
}
56-
5746
fn help_with_man(display_command: &str) {
5847
// Build a "man" process that just echoes the contents.
5948
let p = project()

0 commit comments

Comments
 (0)