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

Function TestRepeatedEnum

proto/text_test.go:1292–1303  ·  view source on GitHub ↗

Regression test; this caused a panic.

(t *testing.T)

Source from the content-addressed store, hash-verified

1290
1291// Regression test; this caused a panic.
1292func TestRepeatedEnum(t *testing.T) {
1293 pb := new(pb2.RepeatedEnum)
1294 if err := proto.UnmarshalText("color: RED", pb); err != nil {
1295 t.Fatal(err)
1296 }
1297 exp := &pb2.RepeatedEnum{
1298 Color: []pb2.RepeatedEnum_Color{pb2.RepeatedEnum_RED},
1299 }
1300 if !proto.Equal(pb, exp) {
1301 t.Errorf("proto.Equal mismatch:\ngot: %v\nwant %v", pb, exp)
1302 }
1303}
1304
1305func TestProto3TextParsing(t *testing.T) {
1306 m := new(pb3.Message)

Callers

nothing calls this directly

Calls 2

UnmarshalTextFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected