Skip to content

Commit

Permalink
ordering of the slice doesnt matter for TrimmedParamName, and test wa…
Browse files Browse the repository at this point in the history
…s failing intermittently due to ordering
  • Loading branch information
husobee committed Apr 4, 2017
1 parent ac1af9b commit 07995cb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@ func TestTrimmedParamNames(t *testing.T) {
// Multiple parameters random name
router.Get("/a/:b/c/:d", func(w http.ResponseWriter, r *http.Request) {
log.Println("/a/:b/c/:d")
assert.Equal(t, []string([]string{"b", "d"}), TrimmedParamNames(r), "Should be [b, c]")
var foundB bool
var foundD bool
for _, v := range TrimmedParamNames(r) {
if v == "b" {
foundB = true
}
if v == "d" {
foundD = true
}
}
assert.True(t, foundB, "Result should contain b")
assert.True(t, foundD, "Result should contain d")
})

rec := httptest.NewRecorder()
Expand Down

0 comments on commit 07995cb

Please sign in to comment.