Skip to content

Commit 8398f9a

Browse files
committed
test: coverage one more config-related function
1 parent 8abb8c9 commit 8398f9a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/config.rs

+11
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ mod tests {
8484
})
8585
}
8686

87+
#[test]
88+
fn test_read_config_from_invalid_file() {
89+
let file = assert_fs::NamedTempFile::new("envfetch.toml").unwrap();
90+
// Just print anything wrong to file
91+
file.write_str("aegkbiv wlecn k").unwrap();
92+
match read_config_from_file(file.path().to_path_buf()) {
93+
Err(ConfigParsingError::ParsingError(_)) => (),
94+
_ => panic!("Should crash with ParsingError")
95+
}
96+
}
97+
8798
#[test]
8899
fn test_read_config_from_unexistent_file() {
89100
let file = assert_fs::NamedTempFile::new("envfetch.toml").unwrap();

0 commit comments

Comments
 (0)