()
| 121 | // Test 4: Compatible mode - serialize with field, deserialize with empty struct |
| 122 | #[test] |
| 123 | fn test_compatible_to_empty_struct() { |
| 124 | #[derive(ForyStruct, Debug)] |
| 125 | struct DataWithField { |
| 126 | value: i32, |
| 127 | name: String, |
| 128 | } |
| 129 | |
| 130 | #[derive(ForyStruct, Debug)] |
| 131 | struct EmptyData {} |
| 132 | |
| 133 | let mut fory1 = Fory::builder().xlang(false).compatible(true).build(); |
| 134 | let mut fory2 = Fory::builder().xlang(false).compatible(true).build(); |
| 135 | fory1.register::<DataWithField>(101).unwrap(); |
| 136 | fory2.register::<EmptyData>(101).unwrap(); |
| 137 | |
| 138 | let data1 = DataWithField { |
| 139 | value: 42, |
| 140 | name: String::from("test"), |
| 141 | }; |
| 142 | let bytes = fory1.serialize(&data1).unwrap(); |
| 143 | let _result: EmptyData = fory2.deserialize(&bytes).unwrap(); |
| 144 | // If we get here without panic, the test passes |
| 145 | } |
| 146 | |
| 147 | // Test 5: Compatible mode - empty struct to struct with fields (fields get defaults) |
| 148 | #[test] |
nothing calls this directly
no test coverage detected