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

Function TestLoadHTMLFilesFuncMap

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

Source from the content-addressed store, hash-verified

306}
307
308func TestLoadHTMLFilesFuncMap(t *testing.T) {
309 ts := setupHTMLFiles(
310 t,
311 TestMode,
312 false,
313 func(router *Engine) {
314 router.LoadHTMLFiles("./testdata/template/hello.tmpl", "./testdata/template/raw.tmpl")
315 },
316 )
317 defer ts.Close()
318
319 res, err := http.Get(ts.URL + "/raw")
320 if err != nil {
321 t.Error(err)
322 }
323
324 resp, _ := io.ReadAll(res.Body)
325 assert.Equal(t, "Date: 2017/07/01", string(resp))
326}
327
328var tmplFS = http.Dir("testdata/template")
329

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected