mirror of
https://github.com/rust-lang/cargo
synced 2024-08-25 10:35:53 +00:00
Add a test to check for regressions in selecting the correct workspace when there are nested workspaces
This commit is contained in:
parent
92ff479275
commit
6070b0aab4
|
@ -2454,3 +2454,50 @@ fn virtual_primary_package_env_var() {
|
|||
p.cargo("clean").run();
|
||||
p.cargo("test -p foo").run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn ensure_correct_workspace_when_nested() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[workspace]
|
||||
|
||||
[project]
|
||||
name = "bar"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
"#,
|
||||
)
|
||||
.file("src/lib.rs", "")
|
||||
.file(
|
||||
"sub/Cargo.toml",
|
||||
r#"
|
||||
[workspace]
|
||||
members = ["foo"]
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"sub/foo/Cargo.toml",
|
||||
r#"
|
||||
[project]
|
||||
name = "foo"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
|
||||
[dependencies]
|
||||
bar = { path = "../.."}
|
||||
"#,
|
||||
)
|
||||
.file("sub/foo/src/main.rs", "fn main() {}");
|
||||
let p = p.build();
|
||||
p.cargo("tree")
|
||||
.cwd("sub/foo")
|
||||
.with_stdout(
|
||||
"\
|
||||
foo v0.1.0 ([..]/foo/sub/foo)
|
||||
└── bar v0.1.0 ([..]/foo)\
|
||||
",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue