Adds more units tests

This commit is contained in:
Manu Mtz-Almeida
2015-06-04 04:50:40 +02:00
parent ee021d06ea
commit 92475baba6
2 changed files with 29 additions and 0 deletions
+25
View File
@@ -123,3 +123,28 @@ func TestRouterGroupTooManyHandlers(t *testing.T) {
router.GET("/", handlers2...)
})
}
func TestRouterGroupBadMethod(t *testing.T) {
router := New()
assert.Panics(t, func() {
router.Handle("get", "/")
})
assert.Panics(t, func() {
router.Handle(" GET", "/")
})
assert.Panics(t, func() {
router.Handle("GET ", "/")
})
assert.Panics(t, func() {
router.Handle("", "/")
})
assert.Panics(t, func() {
router.Handle("PO ST", "/")
})
assert.Panics(t, func() {
router.Handle("1GET", "/")
})
assert.Panics(t, func() {
router.Handle("PATCh", "/")
})
}