From f6673dfdb3f93bacfbf0c0cab4d78bc4154eec0c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 6 Jul 2017 11:43:36 -0700 Subject: One more case of handling newtype structs --- tests/serde.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') 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); + + #[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) + }) + }), + } +} -- cgit v1.2.3