summaryrefslogtreecommitdiffstats
path: root/tests/env.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/env.rs')
-rw-r--r--tests/env.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/env.rs b/tests/env.rs
index 578933e..fdeb373 100644
--- a/tests/env.rs
+++ b/tests/env.rs
@@ -83,3 +83,23 @@ fn test_custom_separator_behavior() {
env::remove_var("C.B.A");
}
+
+fn test_parse_numbers() {
+ env::set_var("INT_VAL", "42");
+ env::set_var("FLOAT_VAL", "42.2");
+
+ let environment = Environment::new().parse_numbers(true);
+ let values = environment.collect().unwrap();
+
+ assert_eq!(
+ values.get("int_val").unwrap().clone().into_int().ok(),
+ Some(42)
+ );
+ assert_eq!(
+ values.get("float_val").unwrap().clone().into_float().ok(),
+ Some(42.2)
+ );
+
+ env::remove_var("INT_VAL");
+ env::remove_var("FLOAT_VAL");
+}