Skip to content

Commit 718b69c

Browse files
committed
Add test for unsupported short exclude flag
Signed-off-by: hi-rustin <[email protected]>
1 parent 819a836 commit 718b69c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/testsuite/build.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4328,6 +4328,41 @@ fn build_all_exclude() {
43284328
.run();
43294329
}
43304330

4331+
#[cargo_test]
4332+
fn cargo_build_with_unsupported_short_exclude_flag() {
4333+
let p = project()
4334+
.file(
4335+
"Cargo.toml",
4336+
r#"
4337+
[package]
4338+
name = "foo"
4339+
version = "0.1.0"
4340+
4341+
[workspace]
4342+
members = ["bar", "baz"]
4343+
"#,
4344+
)
4345+
.file("src/main.rs", "fn main() {}")
4346+
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
4347+
.file("bar/src/lib.rs", "pub fn bar() {}")
4348+
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
4349+
.file("baz/src/lib.rs", "pub fn baz() { break_the_build(); }")
4350+
.build();
4351+
4352+
p.cargo("build --workspace -x baz")
4353+
.with_stderr(
4354+
"\
4355+
error: unexpected argument '-x' found
4356+
4357+
Usage: cargo[EXE] build [OPTIONS]
4358+
4359+
For more information, try '--help'.
4360+
",
4361+
)
4362+
.with_status(1)
4363+
.run();
4364+
}
4365+
43314366
#[cargo_test]
43324367
fn build_all_exclude_not_found() {
43334368
let p = project()

0 commit comments

Comments
 (0)