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

Function TestSetDefaultsWithSubMessage

proto/proto_test.go:1368–1386  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1366}
1367
1368func TestSetDefaultsWithSubMessage(t *testing.T) {
1369 got := &pb2.OtherMessage{
1370 Key: proto.Int64(123),
1371 Inner: &pb2.InnerMessage{
1372 Host: proto.String("gopher"),
1373 },
1374 }
1375 want := &pb2.OtherMessage{
1376 Key: proto.Int64(123),
1377 Inner: &pb2.InnerMessage{
1378 Host: proto.String("gopher"),
1379 Port: proto.Int32(4000),
1380 },
1381 }
1382 proto.SetDefaults(got)
1383 if !proto.Equal(got, want) {
1384 t.Errorf("\n got %v\nwant %v", got, want)
1385 }
1386}
1387
1388func TestSetDefaultsWithRepeatedSubMessage(t *testing.T) {
1389 got := &pb2.MyMessage{

Callers

nothing calls this directly

Calls 5

Int64Function · 0.92
StringFunction · 0.92
Int32Function · 0.92
SetDefaultsFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected