(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestNew(t *testing.T) { |
| 12 | tests := []struct { |
| 13 | err string |
| 14 | want error |
| 15 | }{ |
| 16 | {"", fmt.Errorf("")}, |
| 17 | {"foo", fmt.Errorf("foo")}, |
| 18 | {"foo", New("foo")}, |
| 19 | {"string with format specifiers: %v", errors.New("string with format specifiers: %v")}, |
| 20 | } |
| 21 | |
| 22 | for _, tt := range tests { |
| 23 | got := New(tt.err) |
| 24 | if got.Error() != tt.want.Error() { |
| 25 | t.Errorf("New.Error(): got: %q, want %q", got, tt.want) |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func TestWrapNil(t *testing.T) { |
| 31 | got := Wrap(nil, "no error") |