Add test for unsupported short exclude flag

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
hi-rustin 2023-10-11 09:39:13 +08:00
parent 819a836e9a
commit 718b69ce19

View File

@ -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()