Skip to content

Commit 53ff2e5

Browse files
authored
Fix test that assumes CARGO_CFG_TARGET_FAMILY is a single value (#16079)
### What does this PR try to resolve? This test would break if/when `rustc` outputs further `target_family` cfgs. An example of this could be `target_family = "linux"`, or `target_family = "darwin"` if we decide move forwards with rust-lang/rust#100343. ### How to test and review this PR? ```sh cargo test -- cfg_env_vars_available ```
2 parents e9dbd9f + 5d49edd commit 53ff2e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/testsuite/build_script.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4448,9 +4448,9 @@ fn cfg_env_vars_available() {
44484448
fn main() {
44494449
let fam = env::var("CARGO_CFG_TARGET_FAMILY").unwrap();
44504450
if cfg!(unix) {
4451-
assert_eq!(fam, "unix");
4452-
} else {
4453-
assert_eq!(fam, "windows");
4451+
assert!(fam.contains("unix"));
4452+
} else if cfg!(windows) {
4453+
assert!(fam.contains("windows"));
44544454
}
44554455
}
44564456
"#,

0 commit comments

Comments
 (0)