MCPcopy Create free account
hub / github.com/apache/fory / TestUnregisteredStructSerializationFails

Function TestUnregisteredStructSerializationFails

go/fory/fory_test.go:324–337  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

322}
323
324func TestUnregisteredStructSerializationFails(t *testing.T) {
325 value := explicitRegistrationUser{Name: "bob"}
326
327 fory := NewFory(WithXlang(true), WithCompatible(false), WithRefTracking(false))
328 buf := NewByteBuffer(nil)
329 err := fory.SerializeWithCallback(buf, value, nil)
330 require.Error(t, err)
331 require.Contains(t, err.Error(), "must be registered explicitly")
332
333 fory = NewFory(WithXlang(true), WithCompatible(false), WithRefTracking(false))
334 _, err = fory.Marshal(&value)
335 require.Error(t, err)
336 require.Contains(t, err.Error(), "must be registered explicitly")
337}
338
339func TestRegisterById(t *testing.T) {
340 fory := NewFory(WithXlang(true), WithCompatible(false), WithRefTracking(false))

Callers

nothing calls this directly

Calls 9

SerializeWithCallbackMethod · 0.95
MarshalMethod · 0.95
NewForyFunction · 0.85
WithXlangFunction · 0.85
WithCompatibleFunction · 0.85
WithRefTrackingFunction · 0.85
NewByteBufferFunction · 0.85
ErrorMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected