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

Function DoSpecialStatusMessage

interop/test_utils.go:614–631  ·  view source on GitHub ↗

DoSpecialStatusMessage verifies Unicode and whitespace is correctly processed in status message.

(ctx context.Context, tc testgrpc.TestServiceClient, args ...grpc.CallOption)

Source from the content-addressed store, hash-verified

612// DoSpecialStatusMessage verifies Unicode and whitespace is correctly processed
613// in status message.
614func 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.
634func DoUnimplementedService(ctx context.Context, tc testgrpc.UnimplementedServiceClient) {

Callers 1

mainFunction · 0.92

Calls 5

ErrorFunction · 0.92
CodeTypeAlias · 0.92
UnaryCallMethod · 0.65
ErrorMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected