use coveralls::Env;
#[test]
fn empty_variables_are_treated_as_unset() {
unsafe {
std::env::set_var("COVERALLS_IT_SET", "a-value");
std::env::set_var("COVERALLS_IT_EMPTY", "");
std::env::remove_var("COVERALLS_IT_MISSING");
}
let env = Env::new();
assert_eq!(
env.get_var("COVERALLS_IT_SET").expect("reading a set variable should succeed"),
Some(String::from("a-value")),
);
assert_eq!(
env.get_var("COVERALLS_IT_EMPTY").expect("reading an empty variable should succeed"),
None,
"an empty variable must be reported as unset",
);
assert_eq!(
env.get_var("COVERALLS_IT_MISSING").expect("reading a missing variable should succeed"),
None,
);
}