Skip to content

Commit 3e3383a

Browse files
committed
test: add the dep case
Signed-off-by: Rustin170506 <techregister@pm.me>
1 parent 993a8da commit 3e3383a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/testsuite/script.rs

+33
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,39 @@ fn cmd_pkgid_with_embedded_no_lock_file() {
13381338
.run();
13391339
}
13401340

1341+
#[cargo_test]
1342+
fn cmd_pkgid_with_embedded_dep() {
1343+
Package::new("dep", "1.0.0").publish();
1344+
let script = r#"#!/usr/bin/env cargo
1345+
---
1346+
[dependencies]
1347+
dep = "1.0.0"
1348+
---
1349+
1350+
fn main() {
1351+
println!("Hello world!");
1352+
}"#;
1353+
let p = cargo_test_support::project()
1354+
.file("script.rs", script)
1355+
.build();
1356+
1357+
p.cargo("-Zscript script.rs")
1358+
.masquerade_as_nightly_cargo(&["script"])
1359+
.run();
1360+
1361+
p.cargo("-Zscript pkgid --manifest-path script.rs -p dep")
1362+
.masquerade_as_nightly_cargo(&["script"])
1363+
.with_stdout_data(str![[r#"
1364+
registry+https://github.com/rust-lang/crates.io-index#dep@1.0.0
1365+
1366+
"#]])
1367+
.with_stderr_data(str![[r#"
1368+
[WARNING] `package.edition` is unspecified, defaulting to `2024`
1369+
1370+
"#]])
1371+
.run();
1372+
}
1373+
13411374
#[cargo_test]
13421375
fn cmd_package_with_embedded() {
13431376
let p = cargo_test_support::project()

0 commit comments

Comments
 (0)