From 638377655d76e9c34753c737ada39d13ff6bae68 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Sat, 4 Jul 2015 20:06:40 +0200 Subject: [PATCH] Add unit tests for LoadHTML in debug mode --- gin_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gin_test.go b/gin_test.go index fc9e821..8657d1a 100644 --- a/gin_test.go +++ b/gin_test.go @@ -8,6 +8,7 @@ import ( "reflect" "testing" + "github.com/gin-gonic/gin/render" "github.com/stretchr/testify/assert" ) @@ -27,6 +28,25 @@ func TestCreateEngine(t *testing.T) { 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) { router := New() router.addRoute("GET", "/", HandlersChain{func(_ *Context) {}})