diff --git a/tests/workspaces.rs b/tests/workspaces.rs index 00bb68bd43d..579dfa0dbfe 100644 --- a/tests/workspaces.rs +++ b/tests/workspaces.rs @@ -624,6 +624,28 @@ fn virtual_works() { assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file())); } +#[test] +fn explicit_package_argument_works_with_virtual_manifest() { + let p = project("foo") + .file("Cargo.toml", r#" + [workspace] + members = ["bar"] + "#) + .file("bar/Cargo.toml", r#" + [project] + name = "bar" + version = "0.1.0" + authors = [] + "#) + .file("bar/src/main.rs", "fn main() {}"); + p.build(); + assert_that(p.cargo("build").cwd(p.root()).args(&["--package", "bar"]), + execs().with_status(0)); + assert_that(&p.root().join("Cargo.lock"), existing_file()); + assert_that(&p.bin("bar"), existing_file()); + assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file())); +} + #[test] fn virtual_misconfigure() { let p = project("foo")