(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient)
| 493 | } |
| 494 | |
| 495 | func testFileByFilename(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) { |
| 496 | for _, test := range []struct { |
| 497 | filename string |
| 498 | want []byte |
| 499 | }{ |
| 500 | {"reflection/grpc_testing/test.proto", fdTestByte}, |
| 501 | {"reflection/grpc_testing/proto2.proto", fdProto2Byte}, |
| 502 | {"reflection/grpc_testing/proto2_ext.proto", fdProto2ExtByte}, |
| 503 | {"dynamic.proto", fdDynamicByte}, |
| 504 | } { |
| 505 | if err := stream.Send(&v1reflectionpb.ServerReflectionRequest{ |
| 506 | MessageRequest: &v1reflectionpb.ServerReflectionRequest_FileByFilename{ |
| 507 | FileByFilename: test.filename, |
| 508 | }, |
| 509 | }); err != nil { |
| 510 | t.Fatalf("failed to send request: %v", err) |
| 511 | } |
| 512 | r, err := stream.Recv() |
| 513 | if err != nil { |
| 514 | // io.EOF is not ok. |
| 515 | t.Fatalf("failed to recv response: %v", err) |
| 516 | } |
| 517 | |
| 518 | switch r.MessageResponse.(type) { |
| 519 | case *v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse: |
| 520 | if !reflect.DeepEqual(r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want) { |
| 521 | t.Errorf("FileByFilename(%v)\nreceived: %q,\nwant: %q", test.filename, r.GetFileDescriptorResponse().FileDescriptorProto[0], test.want) |
| 522 | } |
| 523 | default: |
| 524 | t.Errorf("FileByFilename(%v) = %v, want type <ServerReflectionResponse_FileDescriptorResponse>", test.filename, r.MessageResponse) |
| 525 | } |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | func testFileByFilenameError(t *testing.T, stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoClient) { |
| 530 | for _, test := range []string{ |
no test coverage detected