Testing more use cases.

This commit is contained in:
Manu Mtz-Almeida 2015-05-26 17:49:25 +02:00
parent a843d320a5
commit 54a86280f9
1 changed files with 11 additions and 1 deletions

View File

@ -124,10 +124,20 @@ func TestRouteParamsByName(t *testing.T) {
router.GET("/test/:name/:last_name/*wild", func(c *Context) {
name = c.Params.ByName("name")
lastName = c.Params.ByName("last_name")
wild = c.Params.ByName("wild")
var ok bool
wild, ok = c.Params.Get("wild")
assert.True(t, ok)
assert.Equal(t, name, c.Param("name"))
assert.Equal(t, name, c.Param("name"))
assert.Equal(t, lastName, c.Param("last_name"))
assert.Empty(t, c.Param("wtf"))
assert.Empty(t, c.Params.ByName("wtf"))
wtf, ok := c.Params.Get("wtf")
assert.Empty(t, wtf)
assert.False(t, ok)
})
w := performRequest(router, "GET", "/test/john/smith/is/super/great")