MCPcopy
hub / github.com/gin-gonic/gin / TestLoadHTMLFSTestMode

Function TestLoadHTMLFSTestMode

gin_test.go:330–348  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

328var tmplFS = http.Dir("testdata/template")
329
330func TestLoadHTMLFSTestMode(t *testing.T) {
331 ts := setupHTMLFiles(
332 t,
333 TestMode,
334 false,
335 func(router *Engine) {
336 router.LoadHTMLFS(tmplFS, "hello.tmpl", "raw.tmpl")
337 },
338 )
339 defer ts.Close()
340
341 res, err := http.Get(ts.URL + "/test")
342 if err != nil {
343 t.Error(err)
344 }
345
346 resp, _ := io.ReadAll(res.Body)
347 assert.Equal(t, "<h1>Hello world</h1>", string(resp))
348}
349
350func TestLoadHTMLFSDebugMode(t *testing.T) {
351 ts := setupHTMLFiles(

Callers

nothing calls this directly

Calls 5

setupHTMLFilesFunction · 0.85
LoadHTMLFSMethod · 0.80
CloseMethod · 0.80
GetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected