(t *testing.T)
| 19 | ) |
| 20 | |
| 21 | func TestGetExtensionsWithMissingExtensions(t *testing.T) { |
| 22 | msg := &pb2.MyMessage{} |
| 23 | ext1 := &pb2.Ext{} |
| 24 | if err := proto.SetExtension(msg, pb2.E_Ext_More, ext1); err != nil { |
| 25 | t.Fatalf("Could not set ext1: %s", err) |
| 26 | } |
| 27 | exts, err := proto.GetExtensions(msg, []*proto.ExtensionDesc{ |
| 28 | pb2.E_Ext_More, |
| 29 | pb2.E_Ext_Text, |
| 30 | }) |
| 31 | if err != nil { |
| 32 | t.Fatalf("GetExtensions() failed: %s", err) |
| 33 | } |
| 34 | if exts[0] != ext1 { |
| 35 | t.Errorf("ext1 not in returned extensions: %T %v", exts[0], exts[0]) |
| 36 | } |
| 37 | if exts[1] != nil { |
| 38 | t.Errorf("ext2 in returned extensions: %T %v", exts[1], exts[1]) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func TestGetExtensionForIncompleteDesc(t *testing.T) { |
| 43 | msg := &pb2.MyMessage{Count: proto.Int32(0)} |
nothing calls this directly
no test coverage detected