MCPcopy
hub / github.com/grpc/grpc-go / TestFileDescContainingExtension

Method TestFileDescContainingExtension

reflection/test/serverreflection_test.go:124–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func (x) TestFileDescContainingExtension(t *testing.T) {
125 for _, test := range []struct {
126 st string
127 extNum int32
128 want *descriptorpb.FileDescriptorProto
129 }{
130 {"grpc.testing.ToBeExtended", 13, fdProto2Ext},
131 {"grpc.testing.ToBeExtended", 17, fdProto2Ext},
132 {"grpc.testing.ToBeExtended", 19, fdProto2Ext},
133 {"grpc.testing.ToBeExtended", 23, fdProto2Ext2},
134 {"grpc.testing.ToBeExtended", 29, fdProto2Ext2},
135 } {
136 fd, err := s.FileDescEncodingContainingExtension(test.st, test.extNum, map[string]bool{})
137 if err != nil {
138 t.Errorf("fileDescContainingExtension(%q) return error: %v", test.st, err)
139 continue
140 }
141 var actualFd descriptorpb.FileDescriptorProto
142 if err := proto.Unmarshal(fd[0], &actualFd); err != nil {
143 t.Errorf("fileDescContainingExtension(%q) return invalid bytes: %v", test.st, err)
144 continue
145 }
146 if !proto.Equal(&actualFd, test.want) {
147 t.Errorf("fileDescContainingExtension(%q) returned %q, but wanted %q", test.st, &actualFd, test.want)
148 }
149 }
150}
151
152// intArray is used to sort []int32
153type intArray []int32

Callers

nothing calls this directly

Calls 4

ErrorfMethod · 0.65
UnmarshalMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected