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

Function TestGroup

ginS/gins_test.go:137–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestGroup(t *testing.T) {
138 group := Group("/group")
139 group.GET("/test", func(c *gin.Context) {
140 c.String(http.StatusOK, "group test")
141 })
142
143 req := httptest.NewRequest(http.MethodGet, "/group/test", nil)
144 w := httptest.NewRecorder()
145 engine().ServeHTTP(w, req)
146
147 assert.Equal(t, http.StatusOK, w.Code)
148 assert.Equal(t, "group test", w.Body.String())
149}
150
151func TestUse(t *testing.T) {
152 var middlewareExecuted bool

Callers

nothing calls this directly

Calls 4

GroupFunction · 0.85
GETMethod · 0.65
StringMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected