diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/extenv/extenv-arg-2-not-string-literal.stderr | 2 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-env-overload.rs | 9 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-env.rs | 5 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-escaped-var.stderr | 2 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-no-args.stderr | 2 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-not-defined-custom.stderr | 2 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-not-defined-default.stderr | 2 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-not-env.rs | 7 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-not-string-literal.stderr | 2 | ||||
-rw-r--r-- | tests/ui/extenv/extenv-too-many-args.stderr | 2 |
10 files changed, 28 insertions, 7 deletions
diff --git a/tests/ui/extenv/extenv-arg-2-not-string-literal.stderr b/tests/ui/extenv/extenv-arg-2-not-string-literal.stderr index 258e2b347..9db1c0be7 100644 --- a/tests/ui/extenv/extenv-arg-2-not-string-literal.stderr +++ b/tests/ui/extenv/extenv-arg-2-not-string-literal.stderr @@ -4,5 +4,5 @@ error: expected string literal LL | fn main() { env!("one", 10); } | ^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/extenv/extenv-env-overload.rs b/tests/ui/extenv/extenv-env-overload.rs new file mode 100644 index 000000000..b82bb2fe9 --- /dev/null +++ b/tests/ui/extenv/extenv-env-overload.rs @@ -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"); +} diff --git a/tests/ui/extenv/extenv-env.rs b/tests/ui/extenv/extenv-env.rs new file mode 100644 index 000000000..9fda52b89 --- /dev/null +++ b/tests/ui/extenv/extenv-env.rs @@ -0,0 +1,5 @@ +// compile-flags: --env FOO=123abc -Zunstable-options +// run-pass +fn main() { + assert_eq!(env!("FOO"), "123abc"); +} diff --git a/tests/ui/extenv/extenv-escaped-var.stderr b/tests/ui/extenv/extenv-escaped-var.stderr index 25e218c63..ef5e654d0 100644 --- a/tests/ui/extenv/extenv-escaped-var.stderr +++ b/tests/ui/extenv/extenv-escaped-var.stderr @@ -7,5 +7,5 @@ LL | env!("\t"); = help: use `std::env::var("\t")` to read the variable at run time = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/extenv/extenv-no-args.stderr b/tests/ui/extenv/extenv-no-args.stderr index 70b85932c..36d485676 100644 --- a/tests/ui/extenv/extenv-no-args.stderr +++ b/tests/ui/extenv/extenv-no-args.stderr @@ -4,5 +4,5 @@ error: `env!()` takes 1 or 2 arguments LL | fn main() { env!(); } | ^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/extenv/extenv-not-defined-custom.stderr b/tests/ui/extenv/extenv-not-defined-custom.stderr index e7da4e046..9b6e32bc9 100644 --- a/tests/ui/extenv/extenv-not-defined-custom.stderr +++ b/tests/ui/extenv/extenv-not-defined-custom.stderr @@ -6,5 +6,5 @@ LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } | = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/extenv/extenv-not-defined-default.stderr b/tests/ui/extenv/extenv-not-defined-default.stderr index e3dce0005..5198818f8 100644 --- a/tests/ui/extenv/extenv-not-defined-default.stderr +++ b/tests/ui/extenv/extenv-not-defined-default.stderr @@ -7,5 +7,5 @@ LL | env!("CARGO__HOPEFULLY_NOT_DEFINED__"); = help: Cargo sets build script variables at run time. Use `std::env::var("CARGO__HOPEFULLY_NOT_DEFINED__")` instead = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/extenv/extenv-not-env.rs b/tests/ui/extenv/extenv-not-env.rs new file mode 100644 index 000000000..d6c4a43b0 --- /dev/null +++ b/tests/ui/extenv/extenv-not-env.rs @@ -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()); +} diff --git a/tests/ui/extenv/extenv-not-string-literal.stderr b/tests/ui/extenv/extenv-not-string-literal.stderr index 342a9f709..85ed442e2 100644 --- a/tests/ui/extenv/extenv-not-string-literal.stderr +++ b/tests/ui/extenv/extenv-not-string-literal.stderr @@ -4,5 +4,5 @@ error: expected string literal LL | fn main() { env!(10, "two"); } | ^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/extenv/extenv-too-many-args.stderr b/tests/ui/extenv/extenv-too-many-args.stderr index 47cf810b7..c0fd5d572 100644 --- a/tests/ui/extenv/extenv-too-many-args.stderr +++ b/tests/ui/extenv/extenv-too-many-args.stderr @@ -4,5 +4,5 @@ error: `env!()` takes 1 or 2 arguments LL | fn main() { env!("one", "two", "three"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error |