Skip to content

Commit baf8934

Browse files
committed
add regression test for cargo script workspace handling
1 parent bfe4128 commit baf8934

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/testsuite/script.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,3 +1886,54 @@ CARGO_MANIFEST_PATH: [ROOT]/foo/script.rs
18861886
"#]])
18871887
.run();
18881888
}
1889+
1890+
#[cargo_test(nightly, reason = "edition2024 hasn't hit stable yet")]
1891+
fn ignore_surrounding_workspace() {
1892+
let p = cargo_test_support::project()
1893+
.file(
1894+
std::path::Path::new(".cargo").join("config.toml"),
1895+
r#"
1896+
[registries.test-reg]
1897+
index = "https://github.com/rust-lang/crates.io-index"
1898+
"#,
1899+
)
1900+
.file(
1901+
std::path::Path::new("inner").join("Cargo.toml"),
1902+
r#"
1903+
[package]
1904+
name = "inner"
1905+
version = "0.1.0"
1906+
1907+
[dependencies]
1908+
serde = { version = "1.0", registry = "test-reg" }
1909+
"#,
1910+
)
1911+
.file(std::path::Path::new("inner").join("src").join("lib.rs"), "")
1912+
.file(std::path::Path::new("script").join("echo.rs"), ECHO_SCRIPT)
1913+
.file(
1914+
"Cargo.toml",
1915+
r#"
1916+
[workspace]
1917+
members = [
1918+
"inner",
1919+
]
1920+
"#,
1921+
)
1922+
.build();
1923+
1924+
p.cargo("-Zscript -v script/echo.rs")
1925+
.masquerade_as_nightly_cargo(&["script"])
1926+
.with_stdout_data(str![[r#"
1927+
bin: [ROOT]/home/.cargo/target/[HASH]/debug/echo[EXE]
1928+
args: []
1929+
1930+
"#]])
1931+
.with_stderr_data(str![[r#"
1932+
[WARNING] `package.edition` is unspecified, defaulting to `2024`
1933+
[COMPILING] echo v0.0.0 ([ROOT]/foo/script/echo.rs)
1934+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1935+
[RUNNING] `[ROOT]/home/.cargo/target/[HASH]/debug/echo[EXE]`
1936+
1937+
"#]])
1938+
.run();
1939+
}

0 commit comments

Comments
 (0)