Skip to content

Commit 70f7df6

Browse files
Add ui tests for --env option
1 parent 8176ab9 commit 70f7df6

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// run-pass
2+
// compile-flags: --env PATH=123abc -Zunstable-options
3+
4+
// This test ensures that variables provided with `--env` take precedence over
5+
// variables from environment.
6+
fn main() {
7+
assert_eq!(env!("PATH"), "123abc");
8+
}

tests/ui/extenv/extenv-env.rs

+5
Original file line numberDiff line numberDiff 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+
}

tests/ui/extenv/extenv-not-env.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// run-pass
2+
// Ensures that variables not defined through `--env` are stil available.
3+
4+
fn main() {
5+
assert!(!env!("PATH").is_empty());
6+
}

0 commit comments

Comments
 (0)