Skip to content

Commit

Permalink
contrib/dimfeld/httptreemux.v5: failing tests for path variable repla…
Browse files Browse the repository at this point in the history
…cement
  • Loading branch information
MNThomson committed Sep 19, 2024
1 parent 054d19d commit 1dac691
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions contrib/dimfeld/httptreemux.v5/httptreemux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,44 @@ func TestTrailingSlashRoutesWithBehaviorUseHandler(t *testing.T) {
})
}

func TestDuplicateWordsParamsHandler(t *testing.T) {
tests := []struct {
name string
route string
url string
}{
{
name: "Test minimal case",
route: "/1a/:n",
url: "/1a/1",
},
{
name: "Test string with separators",
route: "/foo/2by4/bar/:n",
url: "/foo/2by4/bar/2",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert := assert.New(t)
mt := mocktracer.Start()
defer mt.Stop()

router := New()
router.GET(tt.route, handler200)

r := httptest.NewRequest("GET", tt.url, nil)
w := httptest.NewRecorder()
router.ServeHTTP(w, r)

spans := mt.FinishedSpans()
assert.Equal(1, len(spans))
assert.Equal("GET "+tt.route, spans[0].Tag(ext.ResourceName))
})
}
}

func TestIsSupportedRedirectStatus(t *testing.T) {
tests := []struct {
name string
Expand Down

0 comments on commit 1dac691

Please sign in to comment.