diff options
Diffstat (limited to 'src/rustdoc-json-types/tests.rs')
-rw-r--r-- | src/rustdoc-json-types/tests.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs index 399ff54b2..1126d5f78 100644 --- a/src/rustdoc-json-types/tests.rs +++ b/src/rustdoc-json-types/tests.rs @@ -8,11 +8,15 @@ fn test_struct_info_roundtrip() { impls: vec![], }); + // JSON let struct_json = serde_json::to_string(&s).unwrap(); - let de_s = serde_json::from_str(&struct_json).unwrap(); - assert_eq!(s, de_s); + + // Bincode + let encoded: Vec<u8> = bincode::serialize(&s).unwrap(); + let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap(); + assert_eq!(s, decoded); } #[test] @@ -24,9 +28,13 @@ fn test_union_info_roundtrip() { impls: vec![], }); + // JSON let union_json = serde_json::to_string(&u).unwrap(); - let de_u = serde_json::from_str(&union_json).unwrap(); - assert_eq!(u, de_u); + + // Bincode + let encoded: Vec<u8> = bincode::serialize(&u).unwrap(); + let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap(); + assert_eq!(u, decoded); } |