Skip to content

Commit

Permalink
Add regression test for issue 6915: features and transitive dev deps
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 1, 2023
1 parent 23eb492 commit 649a14d
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 649a14d

Please sign in to comment.