|
|
@@ -5,16 +5,21 @@
|
|
|
package gin
|
|
|
|
|
|
import (
|
|
|
+ "os"
|
|
|
"testing"
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
)
|
|
|
|
|
|
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)
|