1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-24 23:16:47 +02:00

#61 remove internal buffer from arrayAny

This commit is contained in:
Tao Wen
2017-06-18 22:40:18 +08:00
parent 9f9ca4c9fc
commit a84cdaa694
4 changed files with 43 additions and 109 deletions

View File

@ -60,6 +60,8 @@ func Test_array_lazy_any_get_all(t *testing.T) {
should := require.New(t)
any := Get([]byte("[[1],[2],[3,4]]"))
should.Equal("[1,2,3]", any.Get('*', 0).ToString())
any = Get([]byte("[[[1],[2],[3,4]]]"), 0, '*', 0)
should.Equal("[1,2,3]", any.ToString())
}
func Test_array_wrapper_any_get_all(t *testing.T) {
@ -70,6 +72,9 @@ func Test_array_wrapper_any_get_all(t *testing.T) {
{5, 6},
})
should.Equal("[1,3,5]", any.Get('*', 0).ToString())
should.Equal(Array, any.ValueType())
should.True(any.ToBool())
should.Equal(1, any.Get(0, 0).ToInt())
}
func Test_array_lazy_any_get_invalid(t *testing.T) {
@ -85,4 +90,4 @@ func Test_invalid_array(t *testing.T) {
should := require.New(t)
any := Get([]byte("["), 0)
should.Equal(Invalid, any.ValueType())
}
}