(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestHTMLBad(t *testing.T) { |
| 14 | render := New(Options{ |
| 15 | Directory: "testdata/basic", |
| 16 | }) |
| 17 | |
| 18 | var err error |
| 19 | |
| 20 | h := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 21 | err = render.HTML(w, http.StatusOK, "nope", nil) |
| 22 | }) |
| 23 | |
| 24 | res := httptest.NewRecorder() |
| 25 | req, _ := http.NewRequestWithContext(ctx, http.MethodGet, "/foo", nil) |
| 26 | h.ServeHTTP(res, req) |
| 27 | |
| 28 | expectNotNil(t, err) |
| 29 | expect(t, res.Code, 500) |
| 30 | expect(t, res.Body.String(), "html/template: \"nope\" is undefined\n") |
| 31 | } |
| 32 | |
| 33 | func TestHTMLBadDisableHTTPErrorRendering(t *testing.T) { |
| 34 | render := New(Options{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…