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

Function TestHTMLXHTML

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

Source from the content-addressed store, hash-verified

105}
106
107func TestHTMLXHTML(t *testing.T) {
108 render := New(Options{
109 Directory: "testdata/basic",
110 HTMLContentType: ContentXHTML,
111 })
112
113 var err error
114
115 h := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
116 err = render.HTML(w, http.StatusOK, "hello", "gophers")
117 })
118
119 res := httptest.NewRecorder()
120 req, _ := http.NewRequestWithContext(ctx, http.MethodGet, "/foo", nil)
121 h.ServeHTTP(res, req)
122
123 expectNil(t, err)
124 expect(t, res.Code, 200)
125 expect(t, res.Header().Get(ContentType), ContentXHTML+"; charset=UTF-8")
126 expect(t, res.Body.String(), "<h1>Hello gophers</h1>\n")
127}
128
129func TestHTMLExtensions(t *testing.T) {
130 render := New(Options{

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
expectNilFunction · 0.85
expectFunction · 0.85
HTMLMethod · 0.80
StringMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…