From 2fe18bbe8716402f6c56101ccbd55f5f1879d884 Mon Sep 17 00:00:00 2001 From: Christian Fochler Date: Tue, 13 Feb 2018 10:04:55 +0100 Subject: add test for prefix with variant forms of spelling --- tests/env.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests') diff --git a/tests/env.rs b/tests/env.rs index 2a55d7f..b204118 100644 --- a/tests/env.rs +++ b/tests/env.rs @@ -25,6 +25,31 @@ fn test_prefix_is_removed_from_key() { env::remove_var("B_A_C"); } +#[test] +fn test_prefix_with_variant_forms_of_spelling() { + env::set_var("a_A_C", "abc"); + + let environment = Environment::with_prefix("a"); + + assert!(environment.collect().unwrap().contains_key("a_c")); + + env::remove_var("a_A_C"); + env::set_var("aB_A_C", "abc"); + + let environment = Environment::with_prefix("aB"); + + assert!(environment.collect().unwrap().contains_key("a_c")); + + env::remove_var("aB_A_C"); + env::set_var("Ab_A_C", "abc"); + + let environment = Environment::with_prefix("ab"); + + assert!(environment.collect().unwrap().contains_key("a_c")); + + env::remove_var("Ab_A_C"); +} + #[test] fn test_separator_behavior() { env::set_var("C_B_A", "abc"); -- cgit v1.2.3