Skip to content

Commit 61648f5

Browse files
committed
Add test for unsupported silent flag
1 parent 5bf83d8 commit 61648f5

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/testsuite/run.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,43 @@ fn quiet_arg() {
3737
.run();
3838
}
3939

40+
#[cargo_test]
41+
fn unsupported_silent_arg() {
42+
let p = project()
43+
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
44+
.build();
45+
46+
p.cargo("run -s")
47+
.with_stderr(
48+
"\
49+
error: unexpected argument '-s' found
50+
51+
tip: to pass '-s' as a value, use '-- -s'
52+
53+
Usage: cargo run [OPTIONS] [args]...
54+
55+
For more information, try '--help'.
56+
",
57+
)
58+
.with_status(1)
59+
.run();
60+
61+
p.cargo("run --silent")
62+
.with_stderr(
63+
"\
64+
error: unexpected argument '--silent' found
65+
66+
tip: to pass '--silent' as a value, use '-- --silent'
67+
68+
Usage: cargo run [OPTIONS] [args]...
69+
70+
For more information, try '--help'.
71+
",
72+
)
73+
.with_status(1)
74+
.run();
75+
}
76+
4077
#[cargo_test]
4178
fn quiet_arg_and_verbose_arg() {
4279
let p = project()

0 commit comments

Comments
 (0)