Skip to content

Commit 48c998f

Browse files
committed
Add detect_workspace_inherit_public test case.
1 parent a6ca281 commit 48c998f

File tree

12 files changed

+55
-0
lines changed

12 files changed

+55
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[workspace]
2+
members = ["primary", "dependency"]
3+
4+
[workspace.dependencies]
5+
foo = { version = "0.0.0", path = "./dependency"}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[package]
2+
name = "foo"
3+
version = "0.0.0"

tests/testsuite/cargo_add/detect_workspace_inherit_public/in/dependency/src/lib.rs

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cargo-features = ["public-dependency"]
2+
[package]
3+
name = "bar"
4+
version = "0.0.0"

tests/testsuite/cargo_add/detect_workspace_inherit_public/in/primary/src/lib.rs

Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use cargo_test_support::compare::assert_ui;
2+
use cargo_test_support::prelude::*;
3+
use cargo_test_support::Project;
4+
5+
use cargo_test_support::curr_dir;
6+
7+
#[cargo_test]
8+
fn case() {
9+
cargo_test_support::registry::init();
10+
11+
let project = Project::from_template(curr_dir!().join("in"));
12+
let project_root = project.root();
13+
let cwd = &project_root;
14+
15+
snapbox::cmd::Command::cargo_ui()
16+
.arg("add")
17+
.args(["foo", "-p", "bar", "--public"])
18+
.masquerade_as_nightly_cargo(&["public-dependency"])
19+
.current_dir(cwd)
20+
.assert()
21+
.success()
22+
.stdout_matches_path(curr_dir!().join("stdout.log"))
23+
.stderr_matches_path(curr_dir!().join("stderr.log"));
24+
25+
assert_ui().subset_matches(curr_dir!().join("out"), &project_root);
26+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[workspace]
2+
members = ["primary", "dependency"]
3+
4+
[workspace.dependencies]
5+
foo = { version = "0.0.0", path = "./dependency"}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[package]
2+
name = "foo"
3+
version = "0.0.0"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cargo-features = ["public-dependency"]
2+
[package]
3+
name = "bar"
4+
version = "0.0.0"
5+
6+
[dependencies]
7+
foo = { workspace = true, public = true }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adding foo (workspace) to public dependencies.

tests/testsuite/cargo_add/detect_workspace_inherit_public/stdout.log

Whitespace-only changes.

tests/testsuite/cargo_add/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mod deprecated_section;
1212
mod detect_workspace_inherit;
1313
mod detect_workspace_inherit_features;
1414
mod detect_workspace_inherit_optional;
15+
mod detect_workspace_inherit_public;
1516
mod dev;
1617
mod dev_build_conflict;
1718
mod dev_prefer_existing_version;

0 commit comments

Comments
 (0)