mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 09:34:33 +08:00
Tests
Add tests for HandlerNames
This commit is contained in:
parent
5eb80c422c
commit
ab6454e6b7
@ -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) {
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user