add test case of mode

This commit is contained in:
thinkerou 2017-07-05 20:37:28 +08:00
parent 31ac11a298
commit 2a36eefcff

View File

@ -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)
}