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

Function TestNoMethodWithoutGlobalHandlers

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

Source from the content-addressed store, hash-verified

523}
524
525func TestNoMethodWithoutGlobalHandlers(t *testing.T) {
526 var middleware0 HandlerFunc = func(c *Context) {}
527 var middleware1 HandlerFunc = func(c *Context) {}
528
529 router := New()
530
531 router.NoMethod(middleware0)
532 assert.Empty(t, router.Handlers)
533 assert.Len(t, router.noMethod, 1)
534 assert.Len(t, router.allNoMethod, 1)
535 compareFunc(t, router.noMethod[0], middleware0)
536 compareFunc(t, router.allNoMethod[0], middleware0)
537
538 router.NoMethod(middleware1, middleware0)
539 assert.Len(t, router.noMethod, 2)
540 assert.Len(t, router.allNoMethod, 2)
541 compareFunc(t, router.noMethod[0], middleware1)
542 compareFunc(t, router.allNoMethod[0], middleware1)
543 compareFunc(t, router.noMethod[1], middleware0)
544 compareFunc(t, router.allNoMethod[1], middleware0)
545}
546
547func TestRebuild404Handlers(t *testing.T) {
548 var middleware0 HandlerFunc = func(c *Context) {}

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
compareFuncFunction · 0.85
NoMethodMethod · 0.80

Tested by

no test coverage detected