Skip to content

Commit b8aac6b

Browse files
committed
test: add a test for error handling in script installation
Signed-off-by: Rustin170506 <techregister@pm.me>
1 parent 1d960c7 commit b8aac6b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/testsuite/script.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,22 @@ Caused by:
14081408
.run();
14091409
}
14101410

1411+
#[cargo_test]
1412+
fn cmd_install_with_embedded() {
1413+
let p = cargo_test_support::project()
1414+
.file("script.rs", ECHO_SCRIPT)
1415+
.build();
1416+
1417+
p.cargo("-Zscript install --path script.rs")
1418+
.masquerade_as_nightly_cargo(&["script"])
1419+
.with_status(101)
1420+
.with_stderr_data(str![[r#"
1421+
[ERROR] `[ROOT]/foo/script.rs` is not a directory. --path must point to a directory containing a Cargo.toml file.
1422+
1423+
"#]])
1424+
.run();
1425+
}
1426+
14111427
#[cargo_test]
14121428
fn cmd_package_with_embedded() {
14131429
let p = cargo_test_support::project()

0 commit comments

Comments
 (0)