From 9f2da449f9a16d935c9684da0c1175d61b5b0af0 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 f84a425e..6020ad2d 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); + } }