Skip to content

Commit 6ca539c

Browse files
Add test showing float yaml hash keys are unsupported
1 parent 7b2ba76 commit 6ca539c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/testsuite/file_yaml.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,22 @@ inner_bool:
382382
assert_eq!(config.inner_bool.get(&true).unwrap(), "bool true");
383383
assert_eq!(config.inner_bool.get(&false).unwrap(), "bool false");
384384
}
385+
386+
#[test]
387+
fn test_yaml_parsing_float_hash() {
388+
let result = Config::builder()
389+
.add_source(File::from_str(
390+
r#"
391+
inner_float:
392+
0.1: "float 0.1"
393+
0.2: "float 0.2"
394+
"#,
395+
FileFormat::Yaml,
396+
))
397+
.build();
398+
assert!(result.is_err());
399+
assert_data_eq!(
400+
result.unwrap_err().to_string(),
401+
str!["Cannot parse Real(\"0.1\") because it is an unsupported hash key type"]
402+
);
403+
}

0 commit comments

Comments
 (0)