1
0
mirror of https://github.com/json-iterator/go.git synced 2025-02-10 19:41:53 +02:00
json-iterator/jsoniter_any_int_test.go

23 lines
475 B
Go
Raw Normal View History

2017-06-17 21:32:48 +08:00
package jsoniter
import (
"github.com/json-iterator/go/require"
"io"
2017-06-19 23:43:53 +08:00
"testing"
2017-06-17 21:32:48 +08:00
)
func Test_read_int64_as_any(t *testing.T) {
should := require.New(t)
any := Get([]byte("1234"))
2017-06-17 21:32:48 +08:00
should.Equal(1234, any.ToInt())
should.Equal(io.EOF, any.LastError())
should.Equal("1234", any.ToString())
should.True(any.ToBool())
}
func Test_int_lazy_any_get(t *testing.T) {
should := require.New(t)
any := Get([]byte("1234"))
2017-06-17 21:32:48 +08:00
should.Equal(Invalid, any.Get(1, "2").ValueType())
}