From aa63d2dbbcc13fbdfa846185d54d87d7822e2509 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 4 Oct 2023 18:06:24 +0100 Subject: [PATCH] ser: sequences: Test a more comprehensive round-trip Signed-off-by: Ian Jackson --- src/ser.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/ser.rs b/src/ser.rs index f87bea2b..b9e35681 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -732,4 +732,28 @@ mod test { let actual: Test = config.try_deserialize().unwrap(); assert_eq!(test, actual); } + + #[test] + fn test_nest() { + let val = serde_json::json! { { + "top": { + "num": 1, + "array": [2], + "nested": [[3,4]], + "deep": [{ + "yes": true, + }], + "mixed": [ + { "boolish": false, }, + 42, + ["hi"], + { "inner": 66 }, + 23, + ], + } + } }; + let config = Config::try_from(&val).unwrap(); + let output: serde_json::Value = config.try_deserialize().unwrap(); + assert_eq!(val, output); + } }