Add ui tests for --env option

This commit is contained in:
Guillaume Gomez 2023-11-27 13:47:43 +01:00
parent 486e55e547
commit 37d68093da
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// run-pass
// rustc-env:MY_VAR=tadam
// compile-flags: --env MY_VAR=123abc -Zunstable-options
// This test ensures that variables provided with `--env` take precedence over
// variables from environment.
fn main() {
assert_eq!(env!("MY_VAR"), "123abc");
}

View File

@ -0,0 +1,5 @@
// compile-flags: --env FOO=123abc -Zunstable-options
// run-pass
fn main() {
assert_eq!(env!("FOO"), "123abc");
}

View File

@ -0,0 +1,7 @@
// run-pass
// rustc-env:MY_ENV=/
// Ensures that variables not defined through `--env` are still available.
fn main() {
assert!(!env!("MY_ENV").is_empty());
}