MCPcopy
hub / github.com/gogo/protobuf / TestUnknownFieldPreservation

Function TestUnknownFieldPreservation

proto/proto3_test.go:138–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

136}
137
138func TestUnknownFieldPreservation(t *testing.T) {
139 b1 := "\x0a\x05David" // Known tag 1
140 b2 := "\xc2\x0c\x06Google" // Unknown tag 200
141 b := []byte(b1 + b2)
142
143 m := new(pb.Message)
144 if err := proto.Unmarshal(b, m); err != nil {
145 t.Fatalf("proto.Unmarshal: %v", err)
146 }
147
148 if !bytes.Equal(m.XXX_unrecognized, []byte(b2)) {
149 t.Fatalf("mismatching unknown fields:\ngot %q\nwant %q", m.XXX_unrecognized, b2)
150 }
151}

Callers

nothing calls this directly

Calls 2

UnmarshalFunction · 0.92
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…