aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/serde.rs16
1 files changed, 16 insertions, 0 deletions
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::<Foo>().is_ok());
assert!(toml::from_str::<Foo>(&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) }),
+ }
+}