MCPcopy
hub / github.com/pkg/errors / TestWrap

Function TestWrap

errors_test.go:37–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestWrap(t *testing.T) {
38 tests := []struct {
39 err error
40 message string
41 want string
42 }{
43 {io.EOF, "read error", "read error: EOF"},
44 {Wrap(io.EOF, "read error"), "client error", "client error: read error: EOF"},
45 }
46
47 for _, tt := range tests {
48 got := Wrap(tt.err, tt.message).Error()
49 if got != tt.want {
50 t.Errorf("Wrap(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want)
51 }
52 }
53}
54
55type nilError struct{}
56

Callers

nothing calls this directly

Calls 2

WrapFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…