Skip to content

Commit 160d8a4

Browse files
Add test showing panic on unsupported yaml hash key
1 parent 9f2d37e commit 160d8a4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/testsuite/file_yaml.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,18 @@ fn yaml() {
338338
let date: DateTime<Utc> = s.get("yaml_datetime").unwrap();
339339
assert_eq!(date, Utc.with_ymd_and_hms(2017, 6, 12, 10, 58, 30).unwrap());
340340
}
341+
342+
#[test]
343+
#[should_panic]
344+
fn test_yaml_parsing_unsupported_hash() {
345+
let result = Config::builder()
346+
.add_source(File::from_str(
347+
r#"
348+
inner_vec:
349+
[1, 2]: "unsupported"
350+
"#,
351+
FileFormat::Yaml,
352+
))
353+
.build();
354+
assert!(result.is_err());
355+
}

0 commit comments

Comments
 (0)