()
| 1056 | #[test] |
| 1057 | #[ignore] |
| 1058 | fn test_struct_with_map() { |
| 1059 | let data_file_path = get_data_file(); |
| 1060 | let bytes = fs::read(&data_file_path).unwrap(); |
| 1061 | |
| 1062 | let mut fory = Fory::builder().compatible(true).xlang(true).build(); |
| 1063 | fory.register::<StructWithMap>(202).unwrap(); |
| 1064 | let mut reader = Reader::new(bytes.as_slice()); |
| 1065 | |
| 1066 | let struct1 = StructWithMap { |
| 1067 | data: HashMap::from([ |
| 1068 | (Some("key1".to_string()), Some("value1".to_string())), |
| 1069 | (Some("key2".to_string()), Some("value2".to_string())), |
| 1070 | ]), |
| 1071 | }; |
| 1072 | let struct2 = StructWithMap { |
| 1073 | data: HashMap::from([ |
| 1074 | (Some("k1".to_string()), None), |
| 1075 | (None, Some("v2".to_string())), |
| 1076 | ]), |
| 1077 | }; |
| 1078 | |
| 1079 | let remote_struct1: StructWithMap = fory.deserialize_from(&mut reader).unwrap(); |
| 1080 | assert_eq!(remote_struct1, struct1); |
| 1081 | let remote_struct2: StructWithMap = fory.deserialize_from(&mut reader).unwrap(); |
| 1082 | assert_eq!(remote_struct2, struct2); |
| 1083 | |
| 1084 | let mut buf = Vec::new(); |
| 1085 | fory.serialize_to(&mut buf, &remote_struct1).unwrap(); |
| 1086 | fory.serialize_to(&mut buf, &remote_struct2).unwrap(); |
| 1087 | fs::write(&data_file_path, buf).unwrap(); |
| 1088 | } |
| 1089 | |
| 1090 | #[test] |
| 1091 | #[ignore] |
nothing calls this directly
no test coverage detected