Skip to content

Commit

Permalink
Fix env tests, remove unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb8 committed May 4, 2021
1 parent c06915e commit 8f0eca7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/env.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::HashMap;
use std::convert::TryInto;
use std::env;

use crate::error::*;
Expand Down
23 changes: 12 additions & 11 deletions tests/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ fn test_custom_separator_behavior() {
env::remove_var("C.B.A");
}

#[test]
fn test_parse_int() {
// using a struct in an enum here to make serde use `deserialize_any`
#[derive(Deserialize, Debug)]
Expand All @@ -104,7 +105,7 @@ fn test_parse_int() {
env::set_var("INT_VAL", "42");

let environment = Environment::new().try_parsing(true);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Int").unwrap();

Expand Down Expand Up @@ -134,7 +135,7 @@ fn test_parse_float() {
env::set_var("FLOAT_VAL", "42.3");

let environment = Environment::new().try_parsing(true);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Float").unwrap();

Expand Down Expand Up @@ -167,7 +168,7 @@ fn test_parse_bool() {
env::set_var("BOOL_VAL", "true");

let environment = Environment::new().try_parsing(true);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Bool").unwrap();

Expand Down Expand Up @@ -201,7 +202,7 @@ fn test_parse_off_int() {
env::set_var("INT_VAL_1", "42");

let environment = Environment::new().try_parsing(false);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Int").unwrap();

Expand Down Expand Up @@ -230,7 +231,7 @@ fn test_parse_off_float() {
env::set_var("FLOAT_VAL_1", "42.3");

let environment = Environment::new().try_parsing(false);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Float").unwrap();

Expand Down Expand Up @@ -259,7 +260,7 @@ fn test_parse_off_bool() {
env::set_var("BOOL_VAL_1", "true");

let environment = Environment::new().try_parsing(false);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Bool").unwrap();

Expand Down Expand Up @@ -288,7 +289,7 @@ fn test_parse_int_fail() {
env::set_var("INT_VAL_2", "not an int");

let environment = Environment::new().try_parsing(true);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Int").unwrap();

Expand Down Expand Up @@ -317,7 +318,7 @@ fn test_parse_float_fail() {
env::set_var("FLOAT_VAL_2", "not a float");

let environment = Environment::new().try_parsing(true);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Float").unwrap();

Expand Down Expand Up @@ -346,7 +347,7 @@ fn test_parse_bool_fail() {
env::set_var("BOOL_VAL_2", "not a bool");

let environment = Environment::new().try_parsing(true);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "Bool").unwrap();

Expand Down Expand Up @@ -374,7 +375,7 @@ fn test_parse_string() {
env::set_var("STRING_VAL", "test string");

let environment = Environment::new().try_parsing(true);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "String").unwrap();

Expand Down Expand Up @@ -408,7 +409,7 @@ fn test_parse_off_string() {
env::set_var("STRING_VAL_1", "test string");

let environment = Environment::new().try_parsing(false);
let mut config = Config::new();
let mut config = Config::default();

config.set("tag", "String").unwrap();

Expand Down

0 comments on commit 8f0eca7

Please sign in to comment.