1
0
mirror of https://github.com/json-iterator/go.git synced 2024-12-12 09:03:48 +02:00
json-iterator/extra/fuzzy_decoder_test.go

26 lines
485 B
Go
Raw Normal View History

2017-06-20 09:11:01 +02:00
package extra
import (
"testing"
"github.com/json-iterator/go"
"github.com/json-iterator/go/require"
)
func init() {
RegisterFuzzyDecoders()
}
func Test_int_to_string(t *testing.T) {
should := require.New(t)
var val string
should.Nil(jsoniter.UnmarshalFromString(`100`, &val))
should.Equal("100", val)
}
func Test_float_to_string(t *testing.T) {
should := require.New(t)
var val string
should.Nil(jsoniter.UnmarshalFromString(`12.0`, &val))
should.Equal("12.0", val)
}