Code review fixes

This commit is contained in:
Steven Joruk 2021-12-08 21:49:22 +00:00
parent ed9ec388fd
commit 7ac6f53743
4 changed files with 20 additions and 12 deletions

View File

@ -7,6 +7,8 @@ May also be specified with the `term.verbose`
{{#option "`-q`" "`--quiet`"}}
Do not print cargo log messages.
May also be specified with the `term.quiet`
[config value](../reference/config.html).
{{/option}}
{{#option "`--color` _when_"}}

View File

@ -168,6 +168,7 @@ metadata_key1 = "value"
metadata_key2 = "value"
[term]
quiet = false # whether cargo output is quiet
verbose = false # whether cargo provides verbose output
color = 'auto' # whether cargo colorizes output
progress.when = 'auto' # whether cargo shows progress bar

View File

@ -114,6 +114,7 @@ supported environment variables are:
* `CARGO_TARGET_<triple>_LINKER` — The linker to use, see [`target.<triple>.linker`]. The triple must be [converted to uppercase and underscores](config.md#environment-variables).
* `CARGO_TARGET_<triple>_RUNNER` — The executable runner, see [`target.<triple>.runner`].
* `CARGO_TARGET_<triple>_RUSTFLAGS` — Extra `rustc` flags for a target, see [`target.<triple>.rustflags`].
* `CARGO_TERM_QUIET` — Quiet mode, see [`term.quiet`].
* `CARGO_TERM_VERBOSE` — The default terminal verbosity, see [`term.verbose`].
* `CARGO_TERM_COLOR` — The default color mode, see [`term.color`].
* `CARGO_TERM_PROGRESS_WHEN` — The default progress bar showing mode, see [`term.progress.when`].

View File

@ -27,12 +27,11 @@ fn quiet_arg() {
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();
p.cargo("build -q")
.with_stderr_does_not_contain("[FINISHED] [..]")
.run();
p.cargo("run -q").with_stderr("").with_stdout("hello").run();
p.cargo("build --quiet")
.with_stderr_does_not_contain("[FINISHED] [..]")
p.cargo("run --quiet")
.with_stderr("")
.with_stdout("hello")
.run();
}
@ -42,7 +41,7 @@ fn quiet_arg_and_verbose_arg() {
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();
p.cargo("build -q -v")
p.cargo("run -q -v")
.with_status(101)
.with_stderr("[ERROR] cannot set both --verbose and --quiet")
.run();
@ -61,9 +60,7 @@ fn quiet_arg_and_verbose_config() {
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();
p.cargo("build -q")
.with_stderr_does_not_contain("[FINISHED] [..]")
.run();
p.cargo("run -q").with_stderr("").with_stdout("hello").run();
}
#[cargo_test]
@ -79,8 +76,15 @@ fn verbose_arg_and_quiet_config() {
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();
p.cargo("build -v")
.with_stderr_contains("[RUNNING] `rustc [..]")
p.cargo("run -v")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
[RUNNING] `rustc [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/foo[EXE]`",
)
.with_stdout("hello")
.run();
}
@ -98,7 +102,7 @@ fn quiet_config_and_verbose_config() {
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();
p.cargo("build")
p.cargo("run")
.with_status(101)
.with_stderr("[ERROR] cannot set both `term.verbose` and `term.quiet`")
.run();