(t *testing.T)
| 206 | } |
| 207 | |
| 208 | func TestWithMessagef(t *testing.T) { |
| 209 | tests := []struct { |
| 210 | err error |
| 211 | message string |
| 212 | want string |
| 213 | }{ |
| 214 | {io.EOF, "read error", "read error: EOF"}, |
| 215 | {WithMessagef(io.EOF, "read error without format specifier"), "client error", "client error: read error without format specifier: EOF"}, |
| 216 | {WithMessagef(io.EOF, "read error with %d format specifier", 1), "client error", "client error: read error with 1 format specifier: EOF"}, |
| 217 | } |
| 218 | |
| 219 | for _, tt := range tests { |
| 220 | got := WithMessagef(tt.err, tt.message).Error() |
| 221 | if got != tt.want { |
| 222 | t.Errorf("WithMessage(%v, %q): got: %q, want %q", tt.err, tt.message, got, tt.want) |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | // errors.New, etc values are not expected to be compared by value |
| 228 | // but the change in errors#27 made them incomparable. Assert that |
nothing calls this directly
no test coverage detected
searching dependent graphs…