Add tests for HandlerNames
This commit is contained in:
Luis G 2019-01-02 13:57:01 -03:00
parent 5eb80c422c
commit ab6454e6b7

View File

@ -337,10 +337,23 @@ func TestContextHandlerName(t *testing.T) {
assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest$", c.HandlerName())
}
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)
}
}
func handlerNameTest(c *Context) {
}
func handlerNameTest2(c *Context) {
}
var handlerTest HandlerFunc = func(c *Context) {
}