mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 01:12:16 +08:00
Fix HandlerNames test
This commit is contained in:
parent
ab6454e6b7
commit
e4d9a27738
@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user