From ad5bd8758e60fc918423bbbf3dedf04037487d62 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 6 Jul 2017 07:34:45 -0700 Subject: Support deserializing newtypes Closes #196 --- tests/serde.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/serde.rs b/tests/serde.rs index 2f8d871..3ae2bbd 100644 --- a/tests/serde.rs +++ b/tests/serde.rs @@ -509,3 +509,19 @@ fn extra_keys() { assert!(toml.clone().try_into::().is_ok()); assert!(toml::from_str::(&toml.to_string()).is_ok()); } + +#[test] +fn newtypes() { + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct A { + b: B + } + + #[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] + struct B(u32); + + equivalent! { + A { b: B(2) }, + Table(map! { b: Integer(2) }), + } +} -- cgit v1.2.3