Improve router group tests (#2787)
This commit is contained in:
parent
f96678cb6b
commit
caf2802593
@ -112,15 +112,19 @@ func TestRouterGroupInvalidStaticFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRouterGroupTooManyHandlers(t *testing.T) {
|
func TestRouterGroupTooManyHandlers(t *testing.T) {
|
||||||
|
const (
|
||||||
|
panicValue = "too many handlers"
|
||||||
|
maximumCnt = abortIndex
|
||||||
|
)
|
||||||
router := New()
|
router := New()
|
||||||
handlers1 := make([]HandlerFunc, 40)
|
handlers1 := make([]HandlerFunc, maximumCnt-1)
|
||||||
router.Use(handlers1...)
|
router.Use(handlers1...)
|
||||||
|
|
||||||
handlers2 := make([]HandlerFunc, 26)
|
handlers2 := make([]HandlerFunc, maximumCnt+1)
|
||||||
assert.Panics(t, func() {
|
assert.PanicsWithValue(t, panicValue, func() {
|
||||||
router.Use(handlers2...)
|
router.Use(handlers2...)
|
||||||
})
|
})
|
||||||
assert.Panics(t, func() {
|
assert.PanicsWithValue(t, panicValue, func() {
|
||||||
router.GET("/", handlers2...)
|
router.GET("/", handlers2...)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user