瀏覽代碼

add test case of mode

thinkerou 8 年之前
父節點
當前提交
2a36eefcff
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      mode_test.go

+ 6 - 0
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)
 }