diff --git a/tests/testsuite/tool_paths.rs b/tests/testsuite/tool_paths.rs index 48408a24434..b6ae1163ea5 100644 --- a/tests/testsuite/tool_paths.rs +++ b/tests/testsuite/tool_paths.rs @@ -354,7 +354,6 @@ fn custom_linker_env() { } #[cargo_test] -#[cfg(not(windows))] fn target_in_environment_contains_lower_case() { let p = project().file("src/main.rs", "fn main() {}").build(); @@ -364,38 +363,18 @@ fn target_in_environment_contains_lower_case() { ]; for target_key in &target_keys { - p.cargo("build -v --target x86_64-unknown-linux-musl") - .env(target_key, "nonexistent-linker") - .with_status(101) - .with_stderr_contains(format!( + let mut execs = p.cargo("build -v --target x86_64-unknown-linux-musl"); + execs.env(target_key, "nonexistent-linker").with_status(101); + if cfg!(windows) { + execs.with_stderr_does_not_contain("warning:[..]"); + } else { + execs.with_stderr_contains(format!( "warning: Environment variables are expected to use uppercase letters and underscores, \ the variable `{}` will be ignored and have no effect", target_key - )) - .run(); - } -} - -#[cargo_test] -#[cfg(windows)] -fn target_in_environment_contains_lower_case_on_windows() { - let p = project().file("src/main.rs", "fn main() {}").build(); - - let target_keys = [ - "CARGO_TARGET_X86_64_UNKNOWN_LINUX_musl_LINKER", - "CARGO_TARGET_x86_64_unknown_linux_musl_LINKER", - ]; - - for target_key in &target_keys { - p.cargo("build -v --target x86_64-unknown-linux-musl") - .env(target_key, "nonexistent-linker") - .with_status(101) - .with_stderr_does_not_contain(format!( - "warning: Environment variables are expected to use uppercase letters and underscores, \ - the variable `{}` will be ignored and have no effect", - target_key - )) - .run(); + )); + } + execs.run(); } }