Skip to content

Commit

Permalink
Add test for unsupported silent flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Sep 22, 2023
1 parent 5bf83d8 commit 61648f5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/testsuite/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,43 @@ fn quiet_arg() {
.run();
}

#[cargo_test]
fn unsupported_silent_arg() {
let p = project()
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();

p.cargo("run -s")
.with_stderr(
"\
error: unexpected argument '-s' found
tip: to pass '-s' as a value, use '-- -s'
Usage: cargo run [OPTIONS] [args]...
For more information, try '--help'.
",
)
.with_status(1)
.run();

p.cargo("run --silent")
.with_stderr(
"\
error: unexpected argument '--silent' found
tip: to pass '--silent' as a value, use '-- --silent'
Usage: cargo run [OPTIONS] [args]...
For more information, try '--help'.
",
)
.with_status(1)
.run();
}

#[cargo_test]
fn quiet_arg_and_verbose_arg() {
let p = project()
Expand Down

0 comments on commit 61648f5

Please sign in to comment.