| 1722 | } |
| 1723 | |
| 1724 | func 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 | |
| 1737 | func TestSubrouterErrorHandling(t *testing.T) { |
| 1738 | superRouterCalled := false |