From e4d9a27738d63617cc5274855c8b9b46072c7672 Mon Sep 17 00:00:00 2001 From: Luis G Date: Wed, 2 Jan 2019 23:10:08 -0300 Subject: [PATCH] Fix HandlerNames test --- context_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/context_test.go b/context_test.go index 88039f88..7b152ca4 100644 --- a/context_test.go +++ b/context_test.go @@ -341,8 +341,14 @@ func TestContextHandlerNames(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.handlers = HandlersChain{func(c *Context) {}, handlerNameTest, func(c *Context) {}, handlerNameTest2} - for _, val := range c.HandlerNames() { - assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest$", val) + names := c.HandlerNames() + + assert.True(t, len(names) == 4) + if len(names) == 4 { + assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.TestContextHandlerNames.func1$", names[0]) + assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.TestContextHandlerNames.func2$", names[2]) + assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest$", names[1]) + assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest2$", names[3]) } }