Skip to content

Commit

Permalink
Merge pull request #71 from husobee/coverage-improvment
Browse files Browse the repository at this point in the history
upping coverage to 100%
  • Loading branch information
husobee committed Jun 24, 2017
2 parents 909268e + d7c6a70 commit 36dc1d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"testing"

"bytes"

"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -1167,3 +1168,22 @@ func TestRouter_Issue64(t *testing.T) {
assert.Equal(t, w.Body.String(), "custom not found")

}

func TestRouter_MatchAnyFallThrough(t *testing.T) {
r := NewRouter()

r.Get("/*", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "foo") })

// OK
normalRequest, _ := http.NewRequest("GET", "/", nil)

_, h := r.find(normalRequest)

w := httptest.NewRecorder()
if assert.NotNil(t, h) {
h(w, normalRequest)
}

assert.Equal(t, w.Body.String(), "foo\n")

}

0 comments on commit 36dc1d8

Please sign in to comment.