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

lazy array get

This commit is contained in:
Tao Wen
2017-01-24 22:56:18 +08:00
parent fa165c684f
commit ee54218b0a
8 changed files with 22 additions and 27 deletions

View File

@ -80,6 +80,13 @@ func Test_read_array_with_any_iterator(t *testing.T) {
should.Equal([]int{1, 2}, elements)
}
func Test_array_any_get(t *testing.T) {
should := require.New(t)
any, err := UnmarshalAnyFromString("[1,[2,3],4]")
should.Nil(err)
should.Equal(3, any.Get(1,1).ToInt())
}
func Test_invalid_array(t *testing.T) {
_, err := UnmarshalAnyFromString("[")
if err == nil || err == io.EOF {