Test negative indices in path expressions

This commit is contained in:
pkoppstein authored and Nico Williams committed 2023-07-28 12:34:26 -05:00
1 parent 086a156ec3
commit 336c3deb8a
1 file changed
+22
+22
View File
@@ -1002,6 +1002,28 @@ del(.[1], .[-6], .[2], .[-3:9])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 3, 5, 6, 9]
# negative index
setpath([-1]; 1)
[0]
[1]
pick(.a.b.c)
null
{"a":{"b":{"c":null}}}
pick(first)
[1,2]
[1]
pick(first|first)
[[10,20],30]
[[10]]
# negative indices in path expressions (since last/1 is .[-1])
pick(last)
[[10,20],30]
[null,30]
#
# Assignment
#