From b48b221f809343bd4da8242a1ea456efd76f3f90 Mon Sep 17 00:00:00 2001 From: Krishna Sai Veera Reddy Date: Sun, 9 Feb 2020 14:12:40 -0800 Subject: [PATCH] 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. --- tests/ui/option_env_unwrap.rs | 12 ++++++------ tests/ui/option_env_unwrap.stderr | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/ui/option_env_unwrap.rs b/tests/ui/option_env_unwrap.rs index 59463f9a556..642c77460a3 100644 --- a/tests/ui/option_env_unwrap.rs +++ b/tests/ui/option_env_unwrap.rs @@ -14,10 +14,10 @@ macro_rules! option_env_unwrap { } fn main() { - let _ = option_env!("HOME").unwrap(); - let _ = option_env!("HOME").expect("environment variable HOME isn't set"); - let _ = option_env_unwrap!("HOME"); - let _ = option_env_unwrap!("HOME", "environment variable HOME isn't set"); - let _ = option_env_unwrap_external!("HOME"); - let _ = option_env_unwrap_external!("HOME", "environment variable HOME isn't set"); + let _ = option_env!("PATH").unwrap(); + let _ = option_env!("PATH").expect("environment variable PATH isn't set"); + let _ = option_env_unwrap!("PATH"); + let _ = option_env_unwrap!("PATH", "environment variable PATH isn't set"); + let _ = option_env_unwrap_external!("PATH"); + let _ = option_env_unwrap_external!("PATH", "environment variable PATH isn't set"); } diff --git a/tests/ui/option_env_unwrap.stderr b/tests/ui/option_env_unwrap.stderr index 3a2d5d11423..8de9c8a9d29 100644 --- a/tests/ui/option_env_unwrap.stderr +++ b/tests/ui/option_env_unwrap.stderr @@ -1,7 +1,7 @@ error: this will panic at run-time if the environment variable doesn't exist at compile-time --> $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` @@ -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 --> $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 @@ -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 | let _ = option_env_unwrap!("HOME"); +LL | let _ = option_env_unwrap!("PATH"); | -------------------------- in this macro invocation | = 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 | 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 | = 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 --> $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 @@ -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 --> $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