mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Combine target env tests.
This commit is contained in:
parent
4234077bc2
commit
0564466f45
@ -354,7 +354,6 @@ fn custom_linker_env() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
#[cfg(not(windows))]
|
|
||||||
fn target_in_environment_contains_lower_case() {
|
fn target_in_environment_contains_lower_case() {
|
||||||
let p = project().file("src/main.rs", "fn main() {}").build();
|
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 {
|
for target_key in &target_keys {
|
||||||
p.cargo("build -v --target x86_64-unknown-linux-musl")
|
let mut execs = p.cargo("build -v --target x86_64-unknown-linux-musl");
|
||||||
.env(target_key, "nonexistent-linker")
|
execs.env(target_key, "nonexistent-linker").with_status(101);
|
||||||
.with_status(101)
|
if cfg!(windows) {
|
||||||
.with_stderr_contains(format!(
|
execs.with_stderr_does_not_contain("warning:[..]");
|
||||||
|
} else {
|
||||||
|
execs.with_stderr_contains(format!(
|
||||||
"warning: Environment variables are expected to use uppercase letters and underscores, \
|
"warning: Environment variables are expected to use uppercase letters and underscores, \
|
||||||
the variable `{}` will be ignored and have no effect",
|
the variable `{}` will be ignored and have no effect",
|
||||||
target_key
|
target_key
|
||||||
))
|
));
|
||||||
.run();
|
}
|
||||||
}
|
execs.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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user