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

Function TestNewOptionFunc

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

Source from the content-addressed store, hash-verified

919func handlerTest2(c *Context) {}
920
921func 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
938func TestWithOptionFunc(t *testing.T) {
939 r := New()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected