Skip to content

Commit

Permalink
Add test for -Z check-cfg-features with namespaced features
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Feb 22, 2022
1 parent a864c81 commit 4ac4f3d
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6071,3 +6071,44 @@ fn check_cfg_features_with_opt_deps() {
)
.run();
}

#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
#[cargo_test]
fn check_cfg_features_with_namespaced_features() {
if !is_nightly() {
// --check-cfg is a nightly only rustc command line
return;
}

let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.1.0"
[dependencies]
bar = { path = "bar/", optional = true }
[features]
f_a = ["dep:bar"]
f_b = []
"#,
)
.file("src/main.rs", "fn main() {}")
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
.file("bar/src/lib.rs", "#[allow(dead_code)] fn bar() {}")
.build();

p.cargo("build -v -Z check-cfg-features")
.masquerade_as_nightly_cargo()
.with_stderr(
"\
[COMPILING] foo v0.1.0 [..]
[RUNNING] `rustc --crate-name foo [..] --check-cfg 'values(feature, \"f_a\", \"f_b\")' [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
}

0 comments on commit 4ac4f3d

Please sign in to comment.