(t *testing.T)
| 135 | } |
| 136 | |
| 137 | func 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 | |
| 151 | func TestUse(t *testing.T) { |
| 152 | var middlewareExecuted bool |