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

Function TestWithOptionFunc

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

Source from the content-addressed store, hash-verified

936}
937
938func TestWithOptionFunc(t *testing.T) {
939 r := New()
940
941 r.With(func(e *Engine) {
942 e.GET("/test1", handlerTest1)
943 e.GET("/test2", handlerTest2)
944
945 e.Use(func(c *Context) {
946 c.Next()
947 })
948 })
949
950 routes := r.Routes()
951 assertRoutePresent(t, routes, RouteInfo{Path: "/test1", Method: http.MethodGet, Handler: "github.com/gin-gonic/gin.handlerTest1"})
952 assertRoutePresent(t, routes, RouteInfo{Path: "/test2", Method: http.MethodGet, Handler: "github.com/gin-gonic/gin.handlerTest2"})
953}
954
955type Birthday string
956

Callers

nothing calls this directly

Calls 7

NewFunction · 0.85
assertRoutePresentFunction · 0.85
WithMethod · 0.80
NextMethod · 0.80
RoutesMethod · 0.80
GETMethod · 0.65
UseMethod · 0.65

Tested by

no test coverage detected