aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-07-06 11:43:36 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-07-06 11:43:36 -0700
commitf6673dfdb3f93bacfbf0c0cab4d78bc4154eec0c (patch)
tree161ce3d1c582ef27969dca3b3c5f23de1d0d87d7 /tests
parentad5bd8758e60fc918423bbbf3dedf04037487d62 (diff)
downloadmilf-rs-f6673dfdb3f93bacfbf0c0cab4d78bc4154eec0c.tar.gz
milf-rs-f6673dfdb3f93bacfbf0c0cab4d78bc4154eec0c.zip
One more case of handling newtype structs
Diffstat (limited to 'tests')
-rw-r--r--tests/serde.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/serde.rs b/tests/serde.rs
index 3ae2bbd..c61edf5 100644
--- a/tests/serde.rs
+++ b/tests/serde.rs
@@ -525,3 +525,32 @@ fn newtypes() {
Table(map! { b: Integer(2) }),
}
}
+
+#[test]
+fn newtypes2() {
+ #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)]
+ struct A {
+ b: B
+ }
+
+ #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)]
+ struct B(Option<C>);
+
+ #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)]
+ struct C {
+ x: u32,
+ y: u32,
+ z: u32
+ }
+
+ equivalent! {
+ A { b: B(Some(C { x: 0, y: 1, z: 2 })) },
+ Table(map! {
+ b: Table(map! {
+ x: Integer(0),
+ y: Integer(1),
+ z: Integer(2)
+ })
+ }),
+ }
+}