mirror of https://github.com/gin-gonic/gin.git
add test case of mode
This commit is contained in:
parent
2a36eefcff
commit
f843c33370
11
mode_test.go
11
mode_test.go
|
@ -12,10 +12,14 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
SetMode(TestMode)
|
||||
os.Setenv(ENV_GIN_MODE, TestMode)
|
||||
}
|
||||
|
||||
func TestSetMode(t *testing.T) {
|
||||
assert.Equal(t, ginMode, testCode)
|
||||
assert.Equal(t, Mode(), TestMode)
|
||||
os.Unsetenv(ENV_GIN_MODE)
|
||||
|
||||
SetMode(DebugMode)
|
||||
assert.Equal(t, ginMode, debugCode)
|
||||
assert.Equal(t, Mode(), DebugMode)
|
||||
|
@ -29,9 +33,4 @@ 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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue