You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-15 22:50:24 +02:00
#68 number to string
This commit is contained in:
25
extra/fuzzy_decoder_test.go
Normal file
25
extra/fuzzy_decoder_test.go
Normal file
@ -0,0 +1,25 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user