aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAzriel Hoh <azriel91@gmail.com>2018-11-12 09:00:47 +1300
committerAzriel Hoh <azriel91@gmail.com>2018-11-12 09:00:47 +1300
commit2c2d62981279721c87128f988148c876c1caf18c (patch)
tree39c7d28b2726ce8c1dfd36e6c2a29115ed9e8aa3 /tests
parent00ee52194039594e2e842c4448ad952cbd6103da (diff)
downloadmilf-rs-2c2d62981279721c87128f988148c876c1caf18c.tar.gz
milf-rs-2c2d62981279721c87128f988148c876c1caf18c.zip
Added ignored tests for deserializing enums from dotted table.
Issue #225
Diffstat (limited to 'tests')
-rw-r--r--tests/enum_external_deserialize.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/enum_external_deserialize.rs b/tests/enum_external_deserialize.rs
index 76e7a4c..3309ac6 100644
--- a/tests/enum_external_deserialize.rs
+++ b/tests/enum_external_deserialize.rs
@@ -93,6 +93,26 @@ mod enum_newtype {
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 {
@@ -150,4 +170,32 @@ mod enum_array {
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()
+ );
+ }
}