Skip to content

Commit

Permalink
Add test for unsupported short exclude flag
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <[email protected]>
  • Loading branch information
Rustin170506 committed Oct 11, 2023
1 parent 819a836 commit 718b69c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4328,6 +4328,41 @@ fn build_all_exclude() {
.run();
}

#[cargo_test]
fn cargo_build_with_unsupported_short_exclude_flag() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
[workspace]
members = ["bar", "baz"]
"#,
)
.file("src/main.rs", "fn main() {}")
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
.file("bar/src/lib.rs", "pub fn bar() {}")
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
.file("baz/src/lib.rs", "pub fn baz() { break_the_build(); }")
.build();

p.cargo("build --workspace -x baz")
.with_stderr(
"\
error: unexpected argument '-x' found
Usage: cargo[EXE] build [OPTIONS]
For more information, try '--help'.
",
)
.with_status(1)
.run();
}

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

0 comments on commit 718b69c

Please sign in to comment.