MCPcopy
hub / github.com/golang/protobuf / TestUnmarshalOverwriteAny

Function TestUnmarshalOverwriteAny

proto/text_test.go:253–267  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251}
252
253func TestUnmarshalOverwriteAny(t *testing.T) {
254 pb := &anypb.Any{}
255 err := proto.UnmarshalText(`
256 [type.googleapis.com/a/path/proto3_test.Nested]: <
257 bunny: "Monty"
258 >
259 [type.googleapis.com/a/path/proto3_test.Nested]: <
260 bunny: "Rabbit of Caerbannog"
261 >
262 `, pb)
263 want := `line 7: Any message unpacked multiple times, or "type_url" already set`
264 if err.Error() != want {
265 t.Errorf("incorrect error:\ngot: %v\nwant: %v", err.Error(), want)
266 }
267}
268
269func TestUnmarshalAnyMixAndMatch(t *testing.T) {
270 pb := &anypb.Any{}

Callers

nothing calls this directly

Calls 2

UnmarshalTextFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected