MCPcopy
hub / github.com/protocolbuffers/protobuf-go / TestLegacyUnmarshalMethod

Function TestLegacyUnmarshalMethod

proto/methods_test.go:75–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestLegacyUnmarshalMethod(t *testing.T) {
76 sm := &selfMarshaler{}
77 m := impl.Export{}.MessageOf(sm).Interface()
78 want := []byte("unmarshal")
79 if err := proto.Unmarshal(want, m); err != nil {
80 t.Fatalf("proto.Unmarshal(selfMarshaler{}) = %v, want nil", err)
81 }
82 if !bytes.Equal(sm.bytes, want) {
83 t.Fatalf("proto.Unmarshal(selfMarshaler{}): Marshal method not called")
84 }
85}
86
87type descPanicSelfMarshaler struct{}
88

Callers

nothing calls this directly

Calls 4

UnmarshalFunction · 0.92
InterfaceMethod · 0.65
MessageOfMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected