]> git.proxmox.com Git - cargo.git/commitdiff
Combine target env tests.
authorEric Huss <eric@huss.org>
Sun, 14 Feb 2021 19:32:18 +0000 (11:32 -0800)
committerEric Huss <eric@huss.org>
Sun, 14 Feb 2021 19:32:18 +0000 (11:32 -0800)
tests/testsuite/tool_paths.rs

index 48408a24434997926359bdb46eff393d5e66e26b..b6ae1163ea52b4c05c1abd180f71173956f02ec2 100644 (file)
@@ -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();
     }
 }