From 54a86280f96dbf8a72859d5eb5bb13347c7507d6 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Tue, 26 May 2015 17:49:25 +0200 Subject: [PATCH] Testing more use cases. --- routes_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/routes_test.go b/routes_test.go index 04032c2f..6dee24cf 100644 --- a/routes_test.go +++ b/routes_test.go @@ -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")