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

Function TestWithMessage

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

Source from the content-addressed store, hash-verified

181}
182
183func TestWithMessage(t *testing.T) {
184 tests := []struct {
185 err error
186 message string
187 want string
188 }{
189 {io.EOF, "read error", "read error: EOF"},
190 {WithMessage(io.EOF, "read error"), "client error", "client error: read error: EOF"},
191 }
192
193 for _, tt := range tests {
194 got := WithMessage(tt.err, tt.message).Error()
195 if got != tt.want {
196 t.Errorf("WithMessage(%v, %q): got: %q, want %q", tt.err, tt.message, got, tt.want)
197 }
198 }
199}
200
201func TestWithMessagefNil(t *testing.T) {
202 got := WithMessagef(nil, "no error")

Callers

nothing calls this directly

Calls 2

WithMessageFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…