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

View File

@ -10,6 +10,12 @@ import (
"github.com/stretchr/testify/assert"
)
//TODO
// func (engine *Engine) LoadHTMLGlob(pattern string) {
// func (engine *Engine) LoadHTMLFiles(files ...string) {
// func (engine *Engine) Run(addr string) error {
// func (engine *Engine) RunTLS(addr string, cert string, key string) error {
func init() {
SetMode(TestMode)
}
@ -20,9 +26,9 @@ func TestCreateEngine(t *testing.T) {
assert.Equal(t, router.engine, router)
assert.Empty(t, router.Handlers)
// TODO
// assert.Equal(t, router.router.NotFound, router.handle404)
// assert.Equal(t, router.router.MethodNotAllowed, router.handle405)
assert.Panics(t, func() { router.handle("", "/", []HandlerFunc{func(_ *Context) {}}) })
assert.Panics(t, func() { router.handle("GET", "", []HandlerFunc{func(_ *Context) {}}) })
assert.Panics(t, func() { router.handle("GET", "/", []HandlerFunc{}) })
}
func TestCreateDefaultRouter(t *testing.T) {