(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestMessageDescriptor(t *testing.T) { |
| 53 | tests := []struct { |
| 54 | message protoreflect.ProtoMessage |
| 55 | idxs []int |
| 56 | name string |
| 57 | }{{ |
| 58 | message: (*descpb.SourceCodeInfo_Location)(nil), |
| 59 | idxs: []int{ |
| 60 | new(descpb.SourceCodeInfo).ProtoReflect().Descriptor().Index(), |
| 61 | new(descpb.SourceCodeInfo_Location).ProtoReflect().Descriptor().Index(), |
| 62 | }, |
| 63 | name: "Location", |
| 64 | }, { |
| 65 | message: (*descpb.FileDescriptorProto)(nil), |
| 66 | idxs: []int{ |
| 67 | new(descpb.FileDescriptorProto).ProtoReflect().Descriptor().Index(), |
| 68 | }, |
| 69 | name: "FileDescriptorProto", |
| 70 | }} |
| 71 | |
| 72 | for _, tt := range tests { |
| 73 | m := struct{ protoreflect.ProtoMessage }{tt.message} // v2-only message |
| 74 | |
| 75 | _, idxs := MessageRawDescriptor(m) |
| 76 | if diff := cmp.Diff(tt.idxs, idxs); diff != "" { |
| 77 | t.Errorf("path index mismatch (-want +got):\n%v", diff) |
| 78 | } |
| 79 | |
| 80 | _, md := MessageDescriptorProto(m) |
| 81 | if md.GetName() != tt.name { |
| 82 | t.Errorf("mismatching message name: got %v, want %v", md.GetName(), tt.name) |
| 83 | } |
| 84 | } |
| 85 | } |
nothing calls this directly
no test coverage detected