()
| 182 | |
| 183 | #[test] |
| 184 | fn test_json_codec() { |
| 185 | let tests = vec![json!({"hello": "world"})]; |
| 186 | |
| 187 | for t in tests.iter() { |
| 188 | let mut codec = JsonCodec::default(); |
| 189 | let mut buf = BytesMut::new(); |
| 190 | codec.encode(t.clone(), &mut buf).unwrap(); |
| 191 | let decoded = codec.decode(&mut buf).unwrap().unwrap(); |
| 192 | assert_eq!(&decoded, t); |
| 193 | } |
| 194 | } |
| 195 | } |