DoSpecialStatusMessage verifies Unicode and whitespace is correctly processed in status message.
(ctx context.Context, tc testgrpc.TestServiceClient, args ...grpc.CallOption)
| 612 | // DoSpecialStatusMessage verifies Unicode and whitespace is correctly processed |
| 613 | // in status message. |
| 614 | func DoSpecialStatusMessage(ctx context.Context, tc testgrpc.TestServiceClient, args ...grpc.CallOption) { |
| 615 | const ( |
| 616 | code int32 = 2 |
| 617 | msg string = "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n" |
| 618 | ) |
| 619 | expectedErr := status.Error(codes.Code(code), msg) |
| 620 | req := &testpb.SimpleRequest{ |
| 621 | ResponseStatus: &testpb.EchoStatus{ |
| 622 | Code: code, |
| 623 | Message: msg, |
| 624 | }, |
| 625 | } |
| 626 | ctx, cancel := context.WithTimeout(ctx, 10*time.Second) |
| 627 | defer cancel() |
| 628 | if _, err := tc.UnaryCall(ctx, req, args...); err == nil || err.Error() != expectedErr.Error() { |
| 629 | logger.Fatalf("%v.UnaryCall(_, %v) = _, %v, want _, %v", tc, req, err, expectedErr) |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | // DoUnimplementedService attempts to call a method from an unimplemented service. |
| 634 | func DoUnimplementedService(ctx context.Context, tc testgrpc.UnimplementedServiceClient) { |