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

Method TestToRPCErr

rpc_util_test.go:326–344  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

324}
325
326func (s) TestToRPCErr(t *testing.T) {
327 for _, test := range []struct {
328 // input
329 errIn error
330 // outputs
331 errOut error
332 }{
333 {transport.ErrConnClosing, status.Error(codes.Unavailable, transport.ErrConnClosing.Desc)},
334 {io.ErrUnexpectedEOF, status.Error(codes.Internal, io.ErrUnexpectedEOF.Error())},
335 } {
336 err := toRPCErr(test.errIn)
337 if _, ok := status.FromError(err); !ok {
338 t.Errorf("toRPCErr{%v} returned type %T, want %T", test.errIn, err, status.Error)
339 }
340 if !testutils.StatusErrEqual(err, test.errOut) {
341 t.Errorf("toRPCErr{%v} = %v \nwant %v", test.errIn, err, test.errOut)
342 }
343 }
344}
345
346// bmEncode benchmarks encoding a Protocol Buffer message containing mSize
347// bytes.

Callers

nothing calls this directly

Calls 6

ErrorFunction · 0.92
FromErrorFunction · 0.92
StatusErrEqualFunction · 0.92
toRPCErrFunction · 0.85
ErrorMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected