Skip to content

Commit 1514c7e

Browse files
committed
test: add test for script as a dependency
Signed-off-by: Rustin170506 <[email protected]>
1 parent 95f6d0b commit 1514c7e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/testsuite/script.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,47 @@ registry+https://github.com/rust-lang/crates.io-index#[email protected]
13701370
.run();
13711371
}
13721372

1373+
#[cargo_test(nightly, reason = "edition2024 hasn't hit stable yet")]
1374+
fn script_as_dep() {
1375+
let p = cargo_test_support::project()
1376+
.file("script.rs", ECHO_SCRIPT)
1377+
.file("src/lib.rs", "pub fn foo() {}")
1378+
.file(
1379+
"Cargo.toml",
1380+
r#"
1381+
[package]
1382+
name = "foo"
1383+
version = "0.1.0"
1384+
1385+
[dependencies]
1386+
script.path = "script.rs"
1387+
"#,
1388+
)
1389+
.build();
1390+
1391+
p.cargo("build")
1392+
.masquerade_as_nightly_cargo(&["script"])
1393+
.with_status(101)
1394+
.with_stderr_data(str![[r#"
1395+
[WARNING] no edition set: defaulting to the 2015 edition while the latest is 2024
1396+
[ERROR] failed to get `script` as a dependency of package `foo v0.1.0 ([ROOT]/foo)`
1397+
1398+
Caused by:
1399+
failed to load source for dependency `script`
1400+
1401+
Caused by:
1402+
Unable to update [ROOT]/foo/script.rs
1403+
1404+
Caused by:
1405+
failed to read `[ROOT]/foo/script.rs/Cargo.toml`
1406+
1407+
Caused by:
1408+
Not a directory (os error 20)
1409+
1410+
"#]])
1411+
.run();
1412+
}
1413+
13731414
#[cargo_test]
13741415
fn cmd_package_with_embedded() {
13751416
let p = cargo_test_support::project()

0 commit comments

Comments
 (0)