(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestEnumDescriptor(t *testing.T) { |
| 17 | tests := []struct { |
| 18 | enum protoreflect.Enum |
| 19 | idxs []int |
| 20 | name string |
| 21 | }{{ |
| 22 | enum: descpb.FieldDescriptorProto_Type(0), |
| 23 | idxs: []int{ |
| 24 | new(descpb.FieldDescriptorProto).ProtoReflect().Descriptor().Index(), |
| 25 | new(descpb.FieldDescriptorProto_Type).Descriptor().Index(), |
| 26 | }, |
| 27 | name: "Type", |
| 28 | }, { |
| 29 | enum: descpb.FieldOptions_CType(0), |
| 30 | idxs: []int{ |
| 31 | new(descpb.FieldOptions).ProtoReflect().Descriptor().Index(), |
| 32 | new(descpb.FieldOptions_CType).Descriptor().Index(), |
| 33 | }, |
| 34 | name: "CType", |
| 35 | }} |
| 36 | |
| 37 | for _, tt := range tests { |
| 38 | e := struct{ protoreflect.Enum }{tt.enum} // v2-only enum |
| 39 | |
| 40 | _, idxs := EnumRawDescriptor(e) |
| 41 | if diff := cmp.Diff(tt.idxs, idxs); diff != "" { |
| 42 | t.Errorf("path index mismatch (-want +got):\n%v", diff) |
| 43 | } |
| 44 | |
| 45 | _, ed := EnumDescriptorProto(e) |
| 46 | if ed.GetName() != tt.name { |
| 47 | t.Errorf("mismatching enum name: got %v, want %v", ed.GetName(), tt.name) |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestMessageDescriptor(t *testing.T) { |
| 53 | tests := []struct { |
nothing calls this directly
no test coverage detected