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

Function TestIOFSEmbedHTMLBasic

fs_test.go:51–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestIOFSEmbedHTMLBasic(t *testing.T) {
52 render := New(Options{
53 Directory: "testdata/basic",
54 FileSystem: FS(EmbedFixtures),
55 })
56
57 var err error
58
59 h := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
60 err = render.HTML(w, http.StatusOK, "hello", "gophers")
61 })
62
63 res := httptest.NewRecorder()
64 req, _ := http.NewRequestWithContext(ctx, http.MethodGet, "/foo", nil)
65 h.ServeHTTP(res, req)
66
67 expectNil(t, err)
68 expect(t, res.Code, 200)
69 expect(t, res.Header().Get(ContentType), ContentHTML+"; charset=UTF-8")
70 expect(t, res.Body.String(), "<h1>Hello gophers</h1>\n")
71}
72
73func TestIOFSDirHTMLBasic(t *testing.T) {
74 render := New(Options{

Callers

nothing calls this directly

Calls 7

NewFunction · 0.85
FSFunction · 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…