Added ignored tests for deserializing enums from dotted table.

Issue #225
This commit is contained in:
Azriel Hoh 2018-11-12 09:00:47 +13:00
parent a0295b3308
commit 7862f04d08

View file

@ -93,6 +93,26 @@ mod enum_newtype {
toml::from_str(r#"val = { NewType = "value" }"#).unwrap() toml::from_str(r#"val = { NewType = "value" }"#).unwrap()
); );
} }
#[test]
#[ignore = "Unimplemented: https://github.com/alexcrichton/toml-rs/pull/264#issuecomment-431707209"]
fn from_dotted_table() {
assert_eq!(
TheEnum::NewType("value".to_string()),
toml::from_str(r#"NewType = "value""#).unwrap()
);
assert_eq!(
Val {
val: TheEnum::NewType("value".to_string()),
},
toml::from_str(
r#"[val]
NewType = "value"
"#
)
.unwrap()
);
}
} }
mod enum_struct { mod enum_struct {
@ -150,4 +170,32 @@ mod enum_array {
toml::from_str(toml_str).unwrap() toml::from_str(toml_str).unwrap()
); );
} }
#[test]
#[ignore = "Unimplemented: https://github.com/alexcrichton/toml-rs/pull/264#issuecomment-431707209"]
fn from_dotted_table() {
let toml_str = r#"[[enums]]
Plain = {}
[[enums]]
Tuple = { 0 = -123, 1 = true }
[[enums]]
NewType = "value"
[[enums]]
Struct = { value = -123 }
"#;
assert_eq!(
Multi {
enums: vec![
TheEnum::Plain,
TheEnum::Tuple(-123, true),
TheEnum::NewType("value".to_string()),
TheEnum::Struct { value: -123 },
]
},
toml::from_str(toml_str).unwrap()
);
}
} }