Skip to content

Commit 0564466

Browse files
committed
Combine target env tests.
1 parent 4234077 commit 0564466

File tree

1 file changed

+9
-30
lines changed

1 file changed

+9
-30
lines changed

tests/testsuite/tool_paths.rs

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ fn custom_linker_env() {
354354
}
355355

356356
#[cargo_test]
357-
#[cfg(not(windows))]
358357
fn target_in_environment_contains_lower_case() {
359358
let p = project().file("src/main.rs", "fn main() {}").build();
360359

@@ -364,38 +363,18 @@ fn target_in_environment_contains_lower_case() {
364363
];
365364

366365
for target_key in &target_keys {
367-
p.cargo("build -v --target x86_64-unknown-linux-musl")
368-
.env(target_key, "nonexistent-linker")
369-
.with_status(101)
370-
.with_stderr_contains(format!(
366+
let mut execs = p.cargo("build -v --target x86_64-unknown-linux-musl");
367+
execs.env(target_key, "nonexistent-linker").with_status(101);
368+
if cfg!(windows) {
369+
execs.with_stderr_does_not_contain("warning:[..]");
370+
} else {
371+
execs.with_stderr_contains(format!(
371372
"warning: Environment variables are expected to use uppercase letters and underscores, \
372373
the variable `{}` will be ignored and have no effect",
373374
target_key
374-
))
375-
.run();
376-
}
377-
}
378-
379-
#[cargo_test]
380-
#[cfg(windows)]
381-
fn target_in_environment_contains_lower_case_on_windows() {
382-
let p = project().file("src/main.rs", "fn main() {}").build();
383-
384-
let target_keys = [
385-
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_musl_LINKER",
386-
"CARGO_TARGET_x86_64_unknown_linux_musl_LINKER",
387-
];
388-
389-
for target_key in &target_keys {
390-
p.cargo("build -v --target x86_64-unknown-linux-musl")
391-
.env(target_key, "nonexistent-linker")
392-
.with_status(101)
393-
.with_stderr_does_not_contain(format!(
394-
"warning: Environment variables are expected to use uppercase letters and underscores, \
395-
the variable `{}` will be ignored and have no effect",
396-
target_key
397-
))
398-
.run();
375+
));
376+
}
377+
execs.run();
399378
}
400379
}
401380

0 commit comments

Comments
 (0)