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

object lazy any support get all

This commit is contained in:
Tao Wen
2017-01-31 20:26:35 +08:00
parent 498ab96d90
commit bf459b9a49
3 changed files with 35 additions and 13 deletions

View File

@ -147,6 +147,13 @@ func Test_object_lazy_any_get(t *testing.T) {
should.Equal("d", any.Get("a", "b", "c").ToString())
}
func Test_object_lazy_any_get_all(t *testing.T) {
should := require.New(t)
any, err := UnmarshalAnyFromString(`{"a":[0],"b":[1]}`)
should.Nil(err)
should.Equal(`{"a":0,"b":1}`, any.Get('*', 0).ToString())
}
func Test_object_lazy_any_get_invalid(t *testing.T) {
should := require.New(t)
any, err := UnmarshalAnyFromString(`{}`)