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

int lazy any

This commit is contained in:
Tao Wen
2017-01-22 23:29:48 +08:00
parent 9df37bbd68
commit ba410b045b
7 changed files with 248 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"fmt"
"strconv"
"io/ioutil"
"io"
)
func Test_read_uint64_invalid(t *testing.T) {
@ -99,6 +100,16 @@ func Test_read_int64_overflow(t *testing.T) {
should.NotNil(iter.Error)
}
func Test_read_int64_as_any(t *testing.T) {
should := require.New(t)
any, err := UnmarshalAnyFromString("1234")
should.Nil(err)
should.Equal(1234, any.ToInt())
should.Equal(io.EOF, any.LastError())
should.Equal("1234", any.ToString())
should.True(any.ToBool())
}
func Test_write_uint8(t *testing.T) {
vals := []uint8{0, 1, 11, 111, 255}
for _, val := range vals {