1
0
mirror of https://github.com/json-iterator/go.git synced 2024-12-09 08:55:35 +02:00
json-iterator/extra/fuzzy_decoder_test.go
2017-06-20 15:11:01 +08:00

26 lines
485 B
Go

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)
}