From 2a36eefcffe31ad16d9b27fdc64c083e246e80f0 Mon Sep 17 00:00:00 2001 From: thinkerou Date: Wed, 5 Jul 2017 20:37:28 +0800 Subject: [PATCH] add test case of mode --- mode_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mode_test.go b/mode_test.go index 2a23d85..bf6a5a1 100644 --- a/mode_test.go +++ b/mode_test.go @@ -5,6 +5,7 @@ package gin import ( + "os" "testing" "github.com/stretchr/testify/assert" @@ -28,4 +29,9 @@ func TestSetMode(t *testing.T) { assert.Equal(t, Mode(), TestMode) assert.Panics(t, func() { SetMode("unknown") }) + + os.Setenv(ENV_GIN_MODE, DebugMode) + assert.Equal(t, ginMode, debugCode) + assert.Equal(t, Mode(), DebugMode) + os.Unsetenv(ENV_GIN_MODE) }