1
0
mirror of https://github.com/json-iterator/go.git synced 2025-11-26 22:40:13 +02:00

#68 handle float to int safely

This commit is contained in:
Tao Wen
2017-06-20 15:46:22 +08:00
parent a5ae3a2649
commit 8ef0c22f25
2 changed files with 37 additions and 9 deletions

View File

@@ -51,3 +51,9 @@ func Test_float_to_int(t *testing.T) {
should.Nil(jsoniter.UnmarshalFromString(`1.23`, &val))
should.Equal(1, val)
}
func Test_large_float_to_int(t *testing.T) {
should := require.New(t)
var val int
should.NotNil(jsoniter.UnmarshalFromString(`1234512345123451234512345.0`, &val))
}