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

Method TestStatusErrEqual

internal/testutils/status_equal_test.go:48–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46})
47
48func (s) TestStatusErrEqual(t *testing.T) {
49 tests := []struct {
50 name string
51 err1 error
52 err2 error
53 wantEqual bool
54 }{
55 {"nil errors", nil, nil, true},
56 {"equal OK status", status.New(codes.OK, "").Err(), status.New(codes.OK, "").Err(), true},
57 {"equal status errors", statusErr, statusErr, true},
58 {"different status errors", statusErr, status.New(codes.OK, "").Err(), false},
59 }
60
61 for _, test := range tests {
62 if gotEqual := StatusErrEqual(test.err1, test.err2); gotEqual != test.wantEqual {
63 t.Errorf("%v: StatusErrEqual(%v, %v) = %v, want %v", test.name, test.err1, test.err2, gotEqual, test.wantEqual)
64 }
65 }
66}

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
StatusErrEqualFunction · 0.85
ErrMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected