From a1cd868c0224f16d921a25f04cbc39cb03a5471d Mon Sep 17 00:00:00 2001 From: Phil Booth Date: Wed, 26 Sep 2018 06:49:21 +0100 Subject: Treat empty environment variables as unset --- tests/env.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/env.rs b/tests/env.rs index 932d2fc..d1cb11a 100644 --- a/tests/env.rs +++ b/tests/env.rs @@ -60,3 +60,15 @@ fn test_separator_behavior() { env::remove_var("C_B_A"); } + +#[test] +#[cfg(feature = "ignore-empty-env-vars")] +fn test_empty_value_is_ignored() { + env::set_var("C_A_B", ""); + + let environment = Environment::new(); + + assert!(!environment.collect().unwrap().contains_key("c_a_b")); + + env::remove_var("C_A_B"); +} -- cgit v1.2.3