diff --git a/tests/jq.test b/tests/jq.test index f3804a7da2..549d721b10 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -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 #