aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-04-28 15:01:08 -0500
committerGitHub <noreply@github.com>2017-04-28 15:01:08 -0500
commit95b3545938f67ca98d313be5c9c8930ee2407a30 (patch)
tree4ec4a2484d45132da883a11b7a1a6700ba06480d /tests
parentd8b6c83da660db49949bb484c5e3eeea9642cd8e (diff)
parent082ee7090212e8a377b2145fe82712cc41431fee (diff)
downloadmilf-rs-95b3545938f67ca98d313be5c9c8930ee2407a30.tar.gz
milf-rs-95b3545938f67ca98d313be5c9c8930ee2407a30.zip
Merge pull request #165 from Keats/master
Allow to deserialize/serialize into enums
Diffstat (limited to 'tests')
-rw-r--r--tests/serde.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/serde.rs b/tests/serde.rs
index bfbdc6f..0f4c37a 100644
--- a/tests/serde.rs
+++ b/tests/serde.rs
@@ -329,6 +329,25 @@ fn parse_enum() {
}
}
+#[test]
+fn parse_enum_string() {
+ #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
+ struct Foo { a: Sort }
+
+ #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
+ #[serde(rename_all = "lowercase")]
+ enum Sort {
+ Asc,
+ Desc,
+ }
+
+ equivalent! {
+ Foo { a: Sort::Desc },
+ Table(map! { a: Value::String("desc".to_string()) }),
+ }
+
+}
+
// #[test]
// fn unused_fields() {
// #[derive(Serialize, Deserialize, PartialEq, Debug)]