test(alias): panic if alias is empty

This demonstrate the current bad behavior
This commit is contained in:
Weihang Lo 2024-03-20 23:34:09 -04:00
parent f0ae765191
commit 352d8bbe8e
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7

View File

@ -429,3 +429,29 @@ To pass the arguments to the subcommand, remove `--`
)
.run();
}
#[cargo_test]
fn empty_alias() {
let p = project()
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/main.rs", "fn main() {}")
.file(
".cargo/config.toml",
r#"
[alias]
string = ""
array = []
"#,
)
.build();
p.cargo("string")
.with_status(101)
.with_stderr_contains("[..]panicked at[..]")
.run();
p.cargo("array")
.with_status(101)
.with_stderr_contains("[..]panicked at[..]")
.run();
}