mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Use PATH
environment variable for testing
The tests were failing on windows because the `HOME` env variable doesn't exist on it so using the `PATH` variable to test instead.
This commit is contained in:
parent
a3a1587a1c
commit
b48b221f80
@ -14,10 +14,10 @@ macro_rules! option_env_unwrap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = option_env!("HOME").unwrap();
|
let _ = option_env!("PATH").unwrap();
|
||||||
let _ = option_env!("HOME").expect("environment variable HOME isn't set");
|
let _ = option_env!("PATH").expect("environment variable PATH isn't set");
|
||||||
let _ = option_env_unwrap!("HOME");
|
let _ = option_env_unwrap!("PATH");
|
||||||
let _ = option_env_unwrap!("HOME", "environment variable HOME isn't set");
|
let _ = option_env_unwrap!("PATH", "environment variable PATH isn't set");
|
||||||
let _ = option_env_unwrap_external!("HOME");
|
let _ = option_env_unwrap_external!("PATH");
|
||||||
let _ = option_env_unwrap_external!("HOME", "environment variable HOME isn't set");
|
let _ = option_env_unwrap_external!("PATH", "environment variable PATH isn't set");
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
||||||
--> $DIR/option_env_unwrap.rs:17:13
|
--> $DIR/option_env_unwrap.rs:17:13
|
||||||
|
|
|
|
||||||
LL | let _ = option_env!("HOME").unwrap();
|
LL | let _ = option_env!("PATH").unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `-D clippy::option-env-unwrap` implied by `-D warnings`
|
= note: `-D clippy::option-env-unwrap` implied by `-D warnings`
|
||||||
@ -10,7 +10,7 @@ LL | let _ = option_env!("HOME").unwrap();
|
|||||||
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
||||||
--> $DIR/option_env_unwrap.rs:18:13
|
--> $DIR/option_env_unwrap.rs:18:13
|
||||||
|
|
|
|
||||||
LL | let _ = option_env!("HOME").expect("environment variable HOME isn't set");
|
LL | let _ = option_env!("PATH").expect("environment variable PATH isn't set");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using the `env!` macro instead
|
= help: consider using the `env!` macro instead
|
||||||
@ -21,7 +21,7 @@ error: this will panic at run-time if the environment variable doesn't exist at
|
|||||||
LL | option_env!($env).unwrap()
|
LL | option_env!($env).unwrap()
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
...
|
...
|
||||||
LL | let _ = option_env_unwrap!("HOME");
|
LL | let _ = option_env_unwrap!("PATH");
|
||||||
| -------------------------- in this macro invocation
|
| -------------------------- in this macro invocation
|
||||||
|
|
|
|
||||||
= help: consider using the `env!` macro instead
|
= help: consider using the `env!` macro instead
|
||||||
@ -33,7 +33,7 @@ error: this will panic at run-time if the environment variable doesn't exist at
|
|||||||
LL | option_env!($env).expect($message)
|
LL | option_env!($env).expect($message)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
...
|
...
|
||||||
LL | let _ = option_env_unwrap!("HOME", "environment variable HOME isn't set");
|
LL | let _ = option_env_unwrap!("PATH", "environment variable PATH isn't set");
|
||||||
| ----------------------------------------------------------------- in this macro invocation
|
| ----------------------------------------------------------------- in this macro invocation
|
||||||
|
|
|
|
||||||
= help: consider using the `env!` macro instead
|
= help: consider using the `env!` macro instead
|
||||||
@ -42,7 +42,7 @@ LL | let _ = option_env_unwrap!("HOME", "environment variable HOME isn't set
|
|||||||
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
||||||
--> $DIR/option_env_unwrap.rs:21:13
|
--> $DIR/option_env_unwrap.rs:21:13
|
||||||
|
|
|
|
||||||
LL | let _ = option_env_unwrap_external!("HOME");
|
LL | let _ = option_env_unwrap_external!("PATH");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using the `env!` macro instead
|
= help: consider using the `env!` macro instead
|
||||||
@ -51,7 +51,7 @@ LL | let _ = option_env_unwrap_external!("HOME");
|
|||||||
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
error: this will panic at run-time if the environment variable doesn't exist at compile-time
|
||||||
--> $DIR/option_env_unwrap.rs:22:13
|
--> $DIR/option_env_unwrap.rs:22:13
|
||||||
|
|
|
|
||||||
LL | let _ = option_env_unwrap_external!("HOME", "environment variable HOME isn't set");
|
LL | let _ = option_env_unwrap_external!("PATH", "environment variable PATH isn't set");
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using the `env!` macro instead
|
= help: consider using the `env!` macro instead
|
||||||
|
Loading…
Reference in New Issue
Block a user