MCPcopy
hub / github.com/gorilla/mux / TestWalkErrorHandler

Function TestWalkErrorHandler

mux_test.go:1724–1735  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1722}
1723
1724func TestWalkErrorHandler(t *testing.T) {
1725 handler := NewRouter()
1726 expectedError := handler.Path("/path").Subrouter().Path("").GetError()
1727 router := NewRouter()
1728 router.Path("/g").Handler(handler)
1729 err := router.Walk(func(route *Route, router *Router, ancestors []*Route) error {
1730 return route.GetError()
1731 })
1732 if err != expectedError {
1733 t.Errorf("Expected %v routes, found %v", expectedError, err)
1734 }
1735}
1736
1737func TestSubrouterErrorHandling(t *testing.T) {
1738 superRouterCalled := false

Callers

nothing calls this directly

Calls 6

PathMethod · 0.95
WalkMethod · 0.95
NewRouterFunction · 0.85
GetErrorMethod · 0.80
SubrouterMethod · 0.80
HandlerMethod · 0.80

Tested by

no test coverage detected