MCPcopy Index your code
hub / github.com/labstack/echo / TestHTTPError_Error

Function TestHTTPError_Error

httperror_test.go:26–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24}
25
26func 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
50func TestHTTPError_WrapUnwrap(t *testing.T) {
51 err := &HTTPError{Code: http.StatusBadRequest, Message: "bad"}

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…