jsoniter_any_null_test.go 355 B

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