MCPcopy
hub / github.com/gofiber/fiber / Test_Path_matchParams

Function Test_Path_matchParams

path_test.go:143–159  ·  view source on GitHub ↗

go test -race -run Test_Path_matchParams

(t *testing.T)

Source from the content-addressed store, hash-verified

141
142// go test -race -run Test_Path_matchParams
143func Test_Path_matchParams(t *testing.T) {
144 t.Parallel()
145 var ctxParams [maxParams]string
146 testCaseFn := func(testCollection routeCaseCollection) {
147 parser := parseRoute(testCollection.pattern, regexp.MustCompile)
148 for _, c := range testCollection.testCases {
149 match := parser.getMatch(c.url, c.url, &ctxParams, c.partialCheck)
150 require.Equal(t, c.match, match, "route: '%s', url: '%s'", testCollection.pattern, c.url)
151 if match && len(c.params) > 0 {
152 require.Equal(t, c.params[0:len(c.params)], ctxParams[0:len(c.params)], "route: '%s', url: '%s'", testCollection.pattern, c.url)
153 }
154 }
155 }
156 for _, testCaseCollection := range routeTestCases {
157 testCaseFn(testCaseCollection)
158 }
159}
160
161// go test -race -run Test_RoutePatternMatch
162func Test_RoutePatternMatch(t *testing.T) {

Callers

nothing calls this directly

Calls 2

parseRouteFunction · 0.85
getMatchMethod · 0.80

Tested by

no test coverage detected