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

Function TestTreeDoubleWildcard

tree_test.go:539–558  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

537}
538
539func TestTreeDoubleWildcard(t *testing.T) {
540 const panicMsg = "only one wildcard per path segment is allowed"
541
542 routes := [...]string{
543 "/:foo:bar",
544 "/:foo:bar/",
545 "/:foo*bar",
546 }
547
548 for _, route := range routes {
549 tree := &node{}
550 recv := catchPanic(func() {
551 tree.addRoute(route, nil)
552 })
553
554 if rs, ok := recv.(string); !ok || !strings.HasPrefix(rs, panicMsg) {
555 t.Fatalf(`"Expected panic "%s" for route '%s', got "%v"`, panicMsg, route, recv)
556 }
557 }
558}
559
560/*func TestTreeDuplicateWildcard(t *testing.T) {
561 tree := &node{}

Callers

nothing calls this directly

Calls 2

addRouteMethod · 0.95
catchPanicFunction · 0.85

Tested by

no test coverage detected