about summary refs log tree commit diff
path: root/tvix/serde/src/de_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/serde/src/de_tests.rs')
-rw-r--r--tvix/serde/src/de_tests.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tvix/serde/src/de_tests.rs b/tvix/serde/src/de_tests.rs
index 1b9bc04d2362..1613b874d949 100644
--- a/tvix/serde/src/de_tests.rs
+++ b/tvix/serde/src/de_tests.rs
@@ -80,3 +80,18 @@ fn deserialize_struct() {
         }
     );
 }
+
+#[test]
+fn deserialize_newtype() {
+    #[derive(Debug, Deserialize, PartialEq)]
+    struct Number(usize);
+
+    let result: Number = from_str("42").expect("should deserialize");
+    assert_eq!(result, Number(42));
+}
+
+#[test]
+fn deserialize_tuple() {
+    let result: (String, usize) = from_str(r#" [ "foo" 42 ] "#).expect("should deserialize");
+    assert_eq!(result, ("foo".into(), 42));
+}