diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /src/tools/cargo/tests/testsuite/features_namespaced.rs | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cargo/tests/testsuite/features_namespaced.rs')
-rw-r--r-- | src/tools/cargo/tests/testsuite/features_namespaced.rs | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/tools/cargo/tests/testsuite/features_namespaced.rs b/src/tools/cargo/tests/testsuite/features_namespaced.rs index 8ec2fc2e3..f24186c15 100644 --- a/src/tools/cargo/tests/testsuite/features_namespaced.rs +++ b/src/tools/cargo/tests/testsuite/features_namespaced.rs @@ -609,6 +609,7 @@ fn json_exposed() { } ], "workspace_members": "{...}", + "workspace_default_members": "{...}", "resolve": null, "target_directory": "[..]foo/target", "version": 1, @@ -942,6 +943,7 @@ You may press ctrl-c [..] "readme": null, "readme_file": null, "repository": null, + "rust_version": null, "vers": "0.1.0" } "#, @@ -1057,6 +1059,7 @@ You may press ctrl-c [..] "readme": null, "readme_file": null, "repository": null, + "rust_version": null, "vers": "0.1.0" } "#, @@ -1213,3 +1216,81 @@ Caused by: ) .run(); } + +#[cargo_test] +fn dep_feature_when_hidden() { + // Checks for behavior with dep:bar and bar/feat syntax when there is no + // `bar` feature. + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [dependencies] + bar = { path = "bar", optional = true } + + [features] + f1 = ["dep:bar"] + f2 = ["bar/bar_feat"] + "#, + ) + .file("src/lib.rs", "") + .file( + "bar/Cargo.toml", + r#" + [package] + name = "bar" + version = "0.1.0" + + [features] + bar_feat = [] + "#, + ) + .file("bar/src/lib.rs", "") + .build(); + + p.cargo("tree -f") + .arg("{p} features={f}") + .with_stdout( + "\ +foo v0.1.0 ([ROOT]/foo) features=", + ) + .with_stderr("") + .run(); + + p.cargo("tree -F f1 -f") + .arg("{p} features={f}") + .with_stdout( + "\ +foo v0.1.0 ([ROOT]/foo) features=f1 +└── bar v0.1.0 ([ROOT]/foo/bar) features= +", + ) + .with_stderr("") + .run(); + + p.cargo("tree -F f2 -f") + .arg("{p} features={f}") + .with_stdout( + "\ +foo v0.1.0 ([ROOT]/foo) features=f2 +└── bar v0.1.0 ([ROOT]/foo/bar) features=bar_feat +", + ) + .with_stderr("") + .run(); + + p.cargo("tree --all-features -f") + .arg("{p} features={f}") + .with_stdout( + "\ +foo v0.1.0 ([ROOT]/foo) features=f1,f2 +└── bar v0.1.0 ([ROOT]/foo/bar) features=bar_feat +", + ) + .with_stderr("") + .run(); +} |