test: add a test for error handling in script installation

Signed-off-by: Rustin170506 <techregister@pm.me>
This commit is contained in:
Rustin170506 2025-02-03 00:11:55 +08:00
parent 91da8dba0d
commit 9fe45b2010

View File

@ -1408,6 +1408,22 @@ Caused by:
.run();
}
#[cargo_test]
fn cmd_install_with_embedded() {
let p = cargo_test_support::project()
.file("script.rs", ECHO_SCRIPT)
.build();
p.cargo("-Zscript install --path script.rs")
.masquerade_as_nightly_cargo(&["script"])
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] `[ROOT]/foo/script.rs` is not a directory. --path must point to a directory containing a Cargo.toml file.
"#]])
.run();
}
#[cargo_test]
fn cmd_package_with_embedded() {
let p = cargo_test_support::project()