config_test.go 362 B

12345678910111213141516
  1. package test
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/require"
  5. "github.com/json-iterator/go"
  6. "encoding/json"
  7. )
  8. func Test_use_number_for_unmarshal(t *testing.T) {
  9. should := require.New(t)
  10. api := jsoniter.Config{UseNumber: true}.Froze()
  11. var obj interface{}
  12. should.Nil(api.UnmarshalFromString("123", &obj))
  13. should.Equal(json.Number("123"), obj)
  14. }