Tons of unit tests

This commit is contained in:
Manu Mtz-Almeida
2015-04-09 12:15:02 +02:00
parent ac1ee3fb86
commit 0a192fb0fa
26 changed files with 1477 additions and 86 deletions

7
gin.go
View File

@ -144,6 +144,13 @@ func (engine *Engine) handle(method, path string, handlers []HandlerFunc) {
if path[0] != '/' {
panic("path must begin with '/'")
}
if method == "" {
panic("HTTP method can not be empty")
}
if len(handlers) == 0 {
panic("there must be at least one handler")
}
root := engine.trees[method]
if root == nil {
root = new(node)