(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestHandlerUsingNetHTTP(t *testing.T) { |
| 34 | handler := func(ctx iris.Context) { |
| 35 | ctx.WriteString("Hello, World!") |
| 36 | } |
| 37 | |
| 38 | // A shortcut for net/http/httptest.NewRecorder/NewRequest. |
| 39 | w := httptest.NewRecorder() |
| 40 | r := httptest.NewRequest("GET", "/", nil) |
| 41 | |
| 42 | httptest.Do(w, r, handler) |
| 43 | if expected, got := "Hello, World!", w.Body.String(); expected != got { |
| 44 | t.Fatalf("expected body: %s but got: %s", expected, got) |
| 45 | } |
| 46 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…