Add ui tests for --env
option · rust-lang/rust@37d6809 (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 37d6809
Add ui tests for --env
option
File tree
3 files changed
lines changed
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
1 | +// run-pass | |
2 | +// rustc-env:MY_VAR=tadam | |
3 | +// compile-flags: --env MY_VAR=123abc -Zunstable-options | |
4 | + | |
5 | +// This test ensures that variables provided with `--env` take precedence over | |
6 | +// variables from environment. | |
7 | +fn main() { | |
8 | +assert_eq!(env!("MY_VAR"), "123abc"); | |
9 | +} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1 | +// compile-flags: --env FOO=123abc -Zunstable-options | |
2 | +// run-pass | |
3 | +fn main() { | |
4 | +assert_eq!(env!("FOO"), "123abc"); | |
5 | +} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
1 | +// run-pass | |
2 | +// rustc-env:MY_ENV=/ | |
3 | +// Ensures that variables not defined through `--env` are still available. | |
4 | + | |
5 | +fn main() { | |
6 | +assert!(!env!("MY_ENV").is_empty()); | |
7 | +} |