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

Function TestLoadHTMLGlobDebugMode

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

Source from the content-addressed store, hash-verified

63}
64
65func TestLoadHTMLGlobDebugMode(t *testing.T) {
66 ts := setupHTMLFiles(
67 t,
68 DebugMode,
69 false,
70 func(router *Engine) {
71 router.LoadHTMLGlob("./testdata/template/*")
72 },
73 )
74 defer ts.Close()
75
76 res, err := http.Get(ts.URL + "/test")
77 if err != nil {
78 t.Error(err)
79 }
80
81 resp, _ := io.ReadAll(res.Body)
82 assert.Equal(t, "<h1>Hello world</h1>", string(resp))
83}
84
85func TestH2c(t *testing.T) {
86 ln, err := net.Listen("tcp", localhostIP+":0")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected