Skip to content

Commit d89669e

Browse files
committed
Add preliminary test for keywords in cfgs
1 parent 9b66a20 commit d89669e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/testsuite/cfg.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,3 +521,38 @@ error[E0463]: can't find crate for `bar`
521521
"#]])
522522
.run();
523523
}
524+
525+
#[cargo_test]
526+
fn cfg_keywords() {
527+
let p = project()
528+
.file(
529+
"Cargo.toml",
530+
r#"
531+
[package]
532+
name = "foo"
533+
version = "0.1.0"
534+
edition = "2015"
535+
536+
[target.'cfg(any(async, fn, const, return, true))'.dependencies]
537+
b = { path = "b/" }
538+
"#,
539+
)
540+
.file(
541+
".cargo/config.toml",
542+
r#"
543+
[target."cfg(any(for, match, extern, crate, false))"]
544+
"#,
545+
)
546+
.file("src/lib.rs", "")
547+
.file("b/Cargo.toml", &basic_manifest("b", "0.0.1"))
548+
.file("b/src/lib.rs", "pub fn foo() {}")
549+
.build();
550+
551+
p.cargo("check")
552+
.with_stderr_data(str![[r#"
553+
[LOCKING] 1 package to latest compatible version
554+
[CHECKING] foo v0.1.0 ([ROOT]/foo)
555+
...
556+
"#]])
557+
.run();
558+
}

0 commit comments

Comments
 (0)