mirror of https://github.com/gin-gonic/gin.git
Merge pull request #978 from thinkerou/add_mode_case
add test case of mode
This commit is contained in:
commit
316cb812c3
|
@ -5,16 +5,21 @@
|
||||||
package gin
|
package gin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
SetMode(TestMode)
|
os.Setenv(ENV_GIN_MODE, TestMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSetMode(t *testing.T) {
|
func TestSetMode(t *testing.T) {
|
||||||
|
assert.Equal(t, ginMode, testCode)
|
||||||
|
assert.Equal(t, Mode(), TestMode)
|
||||||
|
os.Unsetenv(ENV_GIN_MODE)
|
||||||
|
|
||||||
SetMode(DebugMode)
|
SetMode(DebugMode)
|
||||||
assert.Equal(t, ginMode, debugCode)
|
assert.Equal(t, ginMode, debugCode)
|
||||||
assert.Equal(t, Mode(), DebugMode)
|
assert.Equal(t, Mode(), DebugMode)
|
||||||
|
|
Loading…
Reference in New Issue