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

Function TestNoRouteWithoutGlobalHandlers

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

Source from the content-addressed store, hash-verified

470}
471
472func TestNoRouteWithoutGlobalHandlers(t *testing.T) {
473 var middleware0 HandlerFunc = func(c *Context) {}
474 var middleware1 HandlerFunc = func(c *Context) {}
475
476 router := New()
477
478 router.NoRoute(middleware0)
479 assert.Nil(t, router.Handlers)
480 assert.Len(t, router.noRoute, 1)
481 assert.Len(t, router.allNoRoute, 1)
482 compareFunc(t, router.noRoute[0], middleware0)
483 compareFunc(t, router.allNoRoute[0], middleware0)
484
485 router.NoRoute(middleware1, middleware0)
486 assert.Len(t, router.noRoute, 2)
487 assert.Len(t, router.allNoRoute, 2)
488 compareFunc(t, router.noRoute[0], middleware1)
489 compareFunc(t, router.allNoRoute[0], middleware1)
490 compareFunc(t, router.noRoute[1], middleware0)
491 compareFunc(t, router.allNoRoute[1], middleware0)
492}
493
494func TestNoRouteWithGlobalHandlers(t *testing.T) {
495 var middleware0 HandlerFunc = func(c *Context) {}

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
compareFuncFunction · 0.85
NoRouteMethod · 0.80

Tested by

no test coverage detected