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

Function TestLoadHTMLFilesTestMode

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

Source from the content-addressed store, hash-verified

219}
220
221func TestLoadHTMLFilesTestMode(t *testing.T) {
222 ts := setupHTMLFiles(
223 t,
224 TestMode,
225 false,
226 func(router *Engine) {
227 router.LoadHTMLFiles("./testdata/template/hello.tmpl", "./testdata/template/raw.tmpl")
228 },
229 )
230 defer ts.Close()
231
232 res, err := http.Get(ts.URL + "/test")
233 if err != nil {
234 t.Error(err)
235 }
236
237 resp, _ := io.ReadAll(res.Body)
238 assert.Equal(t, "<h1>Hello world</h1>", string(resp))
239}
240
241func TestLoadHTMLFilesDebugMode(t *testing.T) {
242 ts := setupHTMLFiles(

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