Skip to content

Commit 71cae39

Browse files
committed
Test for crate installation without emitting messages from cwd
1 parent 392b902 commit 71cae39

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

tests/testsuite/install.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,3 +1587,57 @@ fn install_yanked_cargo_package() {
15871587
)
15881588
.run();
15891589
}
1590+
1591+
#[cargo_test]
1592+
fn install_cargo_package_in_a_patched_workspace() {
1593+
pkg("foo", "0.1.0");
1594+
pkg("fizz", "1.0.0");
1595+
1596+
let p = project()
1597+
.file(
1598+
"Cargo.toml",
1599+
r#"
1600+
[package]
1601+
name = "bar"
1602+
version = "0.1.0"
1603+
authors = []
1604+
1605+
[workspace]
1606+
members = ["baz"]
1607+
"#,
1608+
)
1609+
.file("src/main.rs", "fn main() {}")
1610+
.file(
1611+
"baz/Cargo.toml",
1612+
r#"
1613+
[package]
1614+
name = "baz"
1615+
version = "0.1.0"
1616+
authors = []
1617+
1618+
[dependencies]
1619+
fizz = "1"
1620+
1621+
[patch.crates-io]
1622+
fizz = { version = "=1.0.0" }
1623+
"#,
1624+
)
1625+
.file("baz/src/lib.rs", "")
1626+
.build();
1627+
1628+
let stderr = "\
1629+
[WARNING] patch for the non root package will be ignored, specify patch at the workspace root:
1630+
package: [..]/foo/baz/Cargo.toml
1631+
workspace: [..]/foo/Cargo.toml
1632+
";
1633+
p.cargo("check")
1634+
.with_stderr_contains(&stderr)
1635+
.run();
1636+
1637+
// A crate installation must not emit any message from a workspace under
1638+
// current working directory.
1639+
// See https://github.com/rust-lang/cargo/issues/8619
1640+
p.cargo("install foo")
1641+
.with_stderr_does_not_contain(&stderr)
1642+
.run();
1643+
}

0 commit comments

Comments
 (0)