(t *testing.T)
| 24 | } |
| 25 | |
| 26 | func TestHTTPError_Error(t *testing.T) { |
| 27 | var testCases = []struct { |
| 28 | name string |
| 29 | error error |
| 30 | expect string |
| 31 | }{ |
| 32 | { |
| 33 | name: "ok, without message", |
| 34 | error: &HTTPError{Code: http.StatusBadRequest}, |
| 35 | expect: "code=400, message=Bad Request", |
| 36 | }, |
| 37 | { |
| 38 | name: "ok, with message", |
| 39 | error: &HTTPError{Code: http.StatusBadRequest, Message: "my error message"}, |
| 40 | expect: "code=400, message=my error message", |
| 41 | }, |
| 42 | } |
| 43 | for _, tc := range testCases { |
| 44 | t.Run(tc.name, func(t *testing.T) { |
| 45 | assert.Equal(t, tc.expect, tc.error.Error()) |
| 46 | }) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | func TestHTTPError_WrapUnwrap(t *testing.T) { |
| 51 | err := &HTTPError{Code: http.StatusBadRequest, Message: "bad"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…