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

Function TestTreeInvalidEscape

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

Source from the content-addressed store, hash-verified

978}
979
980func TestTreeInvalidEscape(t *testing.T) {
981 routes := map[string]bool{
982 "/r1/r": true,
983 "/r2/:r": true,
984 "/r3/\\:r": true,
985 }
986 tree := &node{}
987 for route, valid := range routes {
988 recv := catchPanic(func() {
989 tree.addRoute(route, fakeHandler(route))
990 })
991 if recv == nil != valid {
992 t.Fatalf("%s should be %t but got %v", route, valid, recv)
993 }
994 }
995}
996
997func TestWildcardInvalidSlash(t *testing.T) {
998 const panicMsgPrefix = "no / before catch-all in path"

Callers

nothing calls this directly

Calls 3

addRouteMethod · 0.95
catchPanicFunction · 0.85
fakeHandlerFunction · 0.85

Tested by

no test coverage detected