jsoniter_any_null_test.go 347 B

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