*func TestTreeDuplicateWildcard(t *testing.T) { tree := &node{} routes := [...]string{ "/:id/:name/:id", } for _, route := range routes { ... } }*/
(t *testing.T)
| 386 | }*/ |
| 387 | |
| 388 | func TestTreeTrailingSlashRedirect(t *testing.T) { |
| 389 | tree := &node{} |
| 390 | |
| 391 | routes := [...]string{ |
| 392 | "/hi", |
| 393 | "/b/", |
| 394 | "/search/:query", |
| 395 | "/cmd/:tool/", |
| 396 | "/src/*filepath", |
| 397 | "/x", |
| 398 | "/x/y", |
| 399 | "/y/", |
| 400 | "/y/z", |
| 401 | "/0/:id", |
| 402 | "/0/:id/1", |
| 403 | "/1/:id/", |
| 404 | "/1/:id/2", |
| 405 | "/aa", |
| 406 | "/a/", |
| 407 | "/admin", |
| 408 | "/admin/:category", |
| 409 | "/admin/:category/:page", |
| 410 | "/doc", |
| 411 | "/doc/go_faq.html", |
| 412 | "/doc/go1.html", |
| 413 | "/no/a", |
| 414 | "/no/b", |
| 415 | "/api/hello/:name", |
| 416 | } |
| 417 | for _, route := range routes { |
| 418 | recv := catchPanic(func() { |
| 419 | tree.addRoute(route, fakeHandler(route)) |
| 420 | }) |
| 421 | if recv != nil { |
| 422 | t.Fatalf("panic inserting route '%s': %v", route, recv) |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | //printChildren(tree, "") |
| 427 | |
| 428 | tsrRoutes := [...]string{ |
| 429 | "/hi/", |
| 430 | "/b", |
| 431 | "/search/gopher/", |
| 432 | "/cmd/vet", |
| 433 | "/src", |
| 434 | "/x/", |
| 435 | "/y", |
| 436 | "/0/go/", |
| 437 | "/1/go", |
| 438 | "/a", |
| 439 | "/admin/", |
| 440 | "/admin/config/", |
| 441 | "/admin/config/permissions/", |
| 442 | "/doc/", |
| 443 | } |
| 444 | for _, route := range tsrRoutes { |
| 445 | handler, _, tsr := tree.getValue(route) |
nothing calls this directly
no test coverage detected