| 38 | } |
| 39 | |
| 40 | fn test_bytes_roundtrip() { |
| 41 | let mut bytes_input = BytesByName::new(); |
| 42 | bytes_input.insert("hello".to_string(), b"world".to_vec()); |
| 43 | bytes_input.insert("bin".to_string(), vec![0u8, 1, 2]); |
| 44 | let bytes_by_name = bytes_roundtrip(&bytes_input); |
| 45 | assert_eq!( |
| 46 | bytes_by_name.get("hello").map(Vec::as_slice), |
| 47 | Some(b"world".as_slice()) |
| 48 | ); |
| 49 | assert_eq!( |
| 50 | bytes_by_name.get("bin").map(Vec::as_slice), |
| 51 | Some([0u8, 1, 2].as_slice()) |
| 52 | ); |
| 53 | } |
| 54 | |
| 55 | fn test_empty_roundtrip() { |
| 56 | let empty = NamesById::new(); |