(t *testing.T)
| 268 | } |
| 269 | |
| 270 | func TestSerializeStructSimple(t *testing.T) { |
| 271 | for _, referenceTracking := range []bool{false, true} { |
| 272 | // Use WithXlang(false) for native Go mode where nil slices/maps are preserved |
| 273 | fory := NewFory(WithXlang(false), WithRefTracking(referenceTracking), WithCompatible(false)) |
| 274 | type A struct { |
| 275 | F1 []string |
| 276 | } |
| 277 | require.Nil(t, fory.RegisterStructByName(A{}, "example.A")) |
| 278 | serde(t, fory, A{}) |
| 279 | serde(t, fory, &A{}) |
| 280 | serde(t, fory, A{F1: []string{"str1", "", "str2"}}) |
| 281 | serde(t, fory, &A{F1: []string{"str1", "", "str2"}}) |
| 282 | |
| 283 | type SimpleB struct { |
| 284 | F1 []string |
| 285 | F2 map[string]int32 |
| 286 | } |
| 287 | require.Nil(t, fory.RegisterStructByName(SimpleB{}, "example.SimpleB")) |
| 288 | serde(t, fory, SimpleB{}) |
| 289 | serde(t, fory, SimpleB{ |
| 290 | F1: []string{"str1", "", "str2"}, |
| 291 | F2: map[string]int32{ |
| 292 | "k1": 1, |
| 293 | "k2": 2, |
| 294 | }, |
| 295 | }) |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | type explicitRegistrationUser struct { |
| 300 | Name string |
nothing calls this directly
no test coverage detected