Add ui tests for --env
option
This commit is contained in:
parent
486e55e547
commit
37d68093da
3 changed files with 21 additions and 0 deletions
9
tests/ui/extenv/extenv-env-overload.rs
Normal file
9
tests/ui/extenv/extenv-env-overload.rs
Normal 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");
|
||||||
|
}
|
5
tests/ui/extenv/extenv-env.rs
Normal file
5
tests/ui/extenv/extenv-env.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// compile-flags: --env FOO=123abc -Zunstable-options
|
||||||
|
// run-pass
|
||||||
|
fn main() {
|
||||||
|
assert_eq!(env!("FOO"), "123abc");
|
||||||
|
}
|
7
tests/ui/extenv/extenv-not-env.rs
Normal file
7
tests/ui/extenv/extenv-not-env.rs
Normal 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());
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue