Skip to content

Commit

Permalink
Add a test to check for regressions in selecting the correct workspac…
Browse files Browse the repository at this point in the history
…e when there are nested workspaces
  • Loading branch information
Muscraft committed Jul 14, 2022
1 parent 92ff479 commit 6070b0a
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/testsuite/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 6070b0a

Please sign in to comment.