MCPcopy Create free account
hub / github.com/unrolled/render / TestHTMLBad

Function TestHTMLBad

render_html_test.go:13–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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
33func TestHTMLBadDisableHTTPErrorRendering(t *testing.T) {
34 render := New(Options{

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
expectNotNilFunction · 0.85
expectFunction · 0.85
HTMLMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…