Skip to content

Commit

Permalink
ser: sequences: Test a more comprehensive round-trip
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
(cherry picked from commit aa63d2d)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
  • Loading branch information
ijackson committed Nov 7, 2023
1 parent 9bed600 commit eb46fd6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit eb46fd6

Please sign in to comment.