mirror of https://github.com/gin-gonic/gin.git
Add unit tests for LoadHTML in debug mode
This commit is contained in:
parent
0e08a109f9
commit
638377655d
20
gin_test.go
20
gin_test.go
|
@ -8,6 +8,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin/render"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,6 +28,25 @@ func TestCreateEngine(t *testing.T) {
|
||||||
assert.Empty(t, router.Handlers)
|
assert.Empty(t, router.Handlers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadHTMLDebugMode(t *testing.T) {
|
||||||
|
router := New()
|
||||||
|
SetMode(DebugMode)
|
||||||
|
router.LoadHTMLGlob("*")
|
||||||
|
r := router.HTMLRender.(render.HTMLDebug)
|
||||||
|
assert.Empty(t, r.Files)
|
||||||
|
assert.Equal(t, r.Glob, "*")
|
||||||
|
|
||||||
|
router.LoadHTMLFiles("index.html", "login.html")
|
||||||
|
r = router.HTMLRender.(render.HTMLDebug)
|
||||||
|
assert.Empty(t, r.Glob)
|
||||||
|
assert.Equal(t, r.Files, []string{"index.html", "login.html"})
|
||||||
|
SetMode(TestMode)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLoadHTMLReleaseMode(t *testing.T) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func TestAddRoute(t *testing.T) {
|
func TestAddRoute(t *testing.T) {
|
||||||
router := New()
|
router := New()
|
||||||
router.addRoute("GET", "/", HandlersChain{func(_ *Context) {}})
|
router.addRoute("GET", "/", HandlersChain{func(_ *Context) {}})
|
||||||
|
|
Loading…
Reference in New Issue