MCPcopy Index your code
hub / github.com/pkg/errors / TestWrapf

Function TestWrapf

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

Source from the content-addressed store, hash-verified

114}
115
116func TestWrapf(t *testing.T) {
117 tests := []struct {
118 err error
119 message string
120 want string
121 }{
122 {io.EOF, "read error", "read error: EOF"},
123 {Wrapf(io.EOF, "read error without format specifiers"), "client error", "client error: read error without format specifiers: EOF"},
124 {Wrapf(io.EOF, "read error with %d format specifier", 1), "client error", "client error: read error with 1 format specifier: EOF"},
125 }
126
127 for _, tt := range tests {
128 got := Wrapf(tt.err, tt.message).Error()
129 if got != tt.want {
130 t.Errorf("Wrapf(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want)
131 }
132 }
133}
134
135func TestErrorf(t *testing.T) {
136 tests := []struct {

Callers

nothing calls this directly

Calls 2

WrapfFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…