| 1181 | } |
| 1182 | |
| 1183 | func TestProto1RepeatedGroup(t *testing.T) { |
| 1184 | pb := &pb2.MessageList{ |
| 1185 | Message: []*pb2.MessageList_Message{ |
| 1186 | { |
| 1187 | Name: proto.String("blah"), |
| 1188 | Count: proto.Int32(7), |
| 1189 | }, |
| 1190 | // NOTE: pb.Message[1] is a nil |
| 1191 | nil, |
| 1192 | }, |
| 1193 | } |
| 1194 | |
| 1195 | o := new(proto.Buffer) |
| 1196 | err := o.Marshal(pb) |
| 1197 | if err == nil { |
| 1198 | t.Fatalf("expected error when marshaling repeted nil MessageList.Message") |
| 1199 | } |
| 1200 | if _, ok := err.(*proto.RequiredNotSetError); !ok { |
| 1201 | t.Fatalf("unexpected error when marshaling: %v", err) |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | // Test that enums work. Checks for a bug introduced by making enums |
| 1206 | // named types instead of int32: newInt32FromUint64 would crash with |