go test -race -run Test_Path_matchParams
(t *testing.T)
| 141 | |
| 142 | // go test -race -run Test_Path_matchParams |
| 143 | func 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 |
| 162 | func Test_RoutePatternMatch(t *testing.T) { |
nothing calls this directly
no test coverage detected