aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJames Kay <twey@twey.co.uk>2019-09-05 15:18:26 +0100
committerAlex Crichton <alex@alexcrichton.com>2019-09-05 09:18:26 -0500
commit95d419ba990920dfdc30b7b88d6df1c0d2d5737f (patch)
tree53bbe2edac3660df0442ca830bc62b7fa5d17c3f /tests
parent6bbafa448922791d54ee253a7a725d4033071c3c (diff)
downloadmilf-rs-95d419ba990920dfdc30b7b88d6df1c0d2d5737f.tar.gz
milf-rs-95d419ba990920dfdc30b7b88d6df1c0d2d5737f.zip
Nested dotted-table enums (#329)
Add support for deserializing enums from nested dotted tables.
Diffstat (limited to 'tests')
-rw-r--r--tests/enum_external_deserialize.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/enum_external_deserialize.rs b/tests/enum_external_deserialize.rs
index 3c38580..6d45b48 100644
--- a/tests/enum_external_deserialize.rs
+++ b/tests/enum_external_deserialize.rs
@@ -3,6 +3,11 @@ extern crate serde_derive;
extern crate toml;
#[derive(Debug, Deserialize, PartialEq)]
+struct OuterStruct {
+ inner: TheEnum,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
enum TheEnum {
Plain,
Tuple(i64, bool),
@@ -181,6 +186,21 @@ mod enum_struct {
.unwrap()
);
}
+
+ #[test]
+ fn from_nested_dotted_table() {
+ assert_eq!(
+ OuterStruct {
+ inner: TheEnum::Struct { value: -123 }
+ },
+ toml::from_str(
+ r#"[inner.Struct]
+ value = -123
+ "#
+ )
+ .unwrap()
+ );
+ }
}
mod enum_array {