1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

#68 float to int

This commit is contained in:
Tao Wen
2017-06-20 15:20:56 +08:00
parent 306b2896cf
commit a5ae3a2649
2 changed files with 8 additions and 1 deletions

View File

@ -44,3 +44,10 @@ func Test_int_to_int(t *testing.T) {
should.Nil(jsoniter.UnmarshalFromString(`100`, &val))
should.Equal(100, val)
}
func Test_float_to_int(t *testing.T) {
should := require.New(t)
var val int
should.Nil(jsoniter.UnmarshalFromString(`1.23`, &val))
should.Equal(1, val)
}