add TestDisableBindValidation (#2071)

This commit is contained in:
Gaozhen Ying 2019-09-24 21:44:15 +08:00 committed by Bo-Yi Wu
parent 2e5a7196cc
commit d6eafcf48a
1 changed files with 8 additions and 0 deletions

View File

@ -40,6 +40,14 @@ func TestSetMode(t *testing.T) {
assert.Panics(t, func() { SetMode("unknown") }) assert.Panics(t, func() { SetMode("unknown") })
} }
func TestDisableBindValidation(t *testing.T) {
v := binding.Validator
assert.NotNil(t, binding.Validator)
DisableBindValidation()
assert.Nil(t, binding.Validator)
binding.Validator = v
}
func TestEnableJsonDecoderUseNumber(t *testing.T) { func TestEnableJsonDecoderUseNumber(t *testing.T) {
assert.False(t, binding.EnableDecoderUseNumber) assert.False(t, binding.EnableDecoderUseNumber)
EnableJsonDecoderUseNumber() EnableJsonDecoderUseNumber()