jsoniter_any_float_test.go 324 B

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