| 919 | func handlerTest2(c *Context) {} |
| 920 | |
| 921 | func TestNewOptionFunc(t *testing.T) { |
| 922 | fc := func(e *Engine) { |
| 923 | e.GET("/test1", handlerTest1) |
| 924 | e.GET("/test2", handlerTest2) |
| 925 | |
| 926 | e.Use(func(c *Context) { |
| 927 | c.Next() |
| 928 | }) |
| 929 | } |
| 930 | |
| 931 | r := New(fc) |
| 932 | |
| 933 | routes := r.Routes() |
| 934 | assertRoutePresent(t, routes, RouteInfo{Path: "/test1", Method: http.MethodGet, Handler: "github.com/gin-gonic/gin.handlerTest1"}) |
| 935 | assertRoutePresent(t, routes, RouteInfo{Path: "/test2", Method: http.MethodGet, Handler: "github.com/gin-gonic/gin.handlerTest2"}) |
| 936 | } |
| 937 | |
| 938 | func TestWithOptionFunc(t *testing.T) { |
| 939 | r := New() |