Skip to content

Commit

Permalink
Auto merge of #12907 - dtolnay-contrib:featuredevtest, r=epage
Browse files Browse the repository at this point in the history
Add regression test for issue 6915: features and transitive dev deps

Closes #6915.

That issue was fixed without realizing by #10103. In search of test coverage, I looked through `rg '[a-z0-9_-]+ = \["[a-z0-9_-]+/[a-z0-9_-]+"\]' tests/testsuite/` and did not find any existing test that exercises this situation. The tests added by #10103 are focused on cycles and `cargo tree`, which is substantially different from #6915.

Tested by `cargo test --test testsuite -- features::activating_feature_does_not_activate_transitive_dev_dependency`.
  • Loading branch information
bors committed Nov 1, 2023
2 parents 23eb492 + 649a14d commit 5613aac
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions tests/testsuite/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,61 @@ fn activating_feature_activates_dep() {
p.cargo("check --features a -v").run();
}

#[cargo_test]
fn activating_feature_does_not_activate_transitive_dev_dependency() {
let p = project()
.no_manifest()
.file(
"a/Cargo.toml",
r#"
[package]
name = "a"
version = "0.0.0"
edition = "2021"
[features]
f = ["b/f"]
[dependencies]
b = { path = "../b" }
"#,
)
.file(
"b/Cargo.toml",
r#"
[package]
name = "b"
version = "0.0.0"
edition = "2021"
[features]
f = ["c/f"]
[dev-dependencies]
c = { path = "../c" }
"#,
)
.file(
"c/Cargo.toml",
r#"
[package]
name = "c"
version = "0.0.0"
edition = "2021"
[features]
f = []
"#,
)
.file("a/src/lib.rs", "")
.file("b/src/lib.rs", "")
.file("c/src/lib.rs", "compile_error!")
.build();

p.cargo("check --manifest-path a/Cargo.toml --features f")
.run();
}

#[cargo_test]
fn dep_feature_in_cmd_line() {
let p = project()
Expand Down

0 comments on commit 5613aac

Please sign in to comment.