(t *testing.T)
| 995 | } |
| 996 | |
| 997 | func TestWildcardInvalidSlash(t *testing.T) { |
| 998 | const panicMsgPrefix = "no / before catch-all in path" |
| 999 | |
| 1000 | routes := map[string]bool{ |
| 1001 | "/foo/bar": true, |
| 1002 | "/foo/x*zy": false, |
| 1003 | "/foo/b*r": false, |
| 1004 | } |
| 1005 | |
| 1006 | for route, valid := range routes { |
| 1007 | tree := &node{} |
| 1008 | recv := catchPanic(func() { |
| 1009 | tree.addRoute(route, nil) |
| 1010 | }) |
| 1011 | |
| 1012 | if recv == nil != valid { |
| 1013 | t.Fatalf("%s should be %t but got %v", route, valid, recv) |
| 1014 | } |
| 1015 | |
| 1016 | if rs, ok := recv.(string); recv != nil && (!ok || !strings.HasPrefix(rs, panicMsgPrefix)) { |
| 1017 | t.Fatalf(`"Expected panic "%s" for route '%s', got "%v"`, panicMsgPrefix, route, recv) |
| 1018 | } |
| 1019 | } |
| 1020 | } |
| 1021 | |
| 1022 | func TestTreeFindCaseInsensitivePathWithMultipleChildrenAndWildcard(t *testing.T) { |
| 1023 | tree := &node{} |
nothing calls this directly
no test coverage detected