jsoniter_any_null_test.go 314 B

123456789101112131415
  1. package jsoniter
  2. import (
  3. "github.com/json-iterator/go/require"
  4. "testing"
  5. )
  6. func Test_read_null_as_any(t *testing.T) {
  7. should := require.New(t)
  8. any := Get([]byte(`null`))
  9. should.Equal(0, any.ToInt())
  10. should.Equal(float64(0), any.ToFloat64())
  11. should.Equal("", any.ToString())
  12. should.False(any.ToBool())
  13. }