summaryrefslogtreecommitdiffstats
path: root/tests/jq.test
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-07-09 12:56:59 +0900
committerNico Williams <nico@cryptonector.com>2023-07-08 23:13:15 -0500
commitd8072564c28d38d29aa0a7c416621f02c19f7f44 (patch)
tree47e98bb8a510f15d927b3e0ea50d292881e009d9 /tests/jq.test
parente2bc8de8bb0487e9ae9f8d8203cf4988154ba3f0 (diff)
Fix nth/2 to emit empty on index out of range
Diffstat (limited to 'tests/jq.test')
-rw-r--r--tests/jq.test8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/jq.test b/tests/jq.test
index 193025da..4e693452 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -319,9 +319,13 @@ null
"badness"
[1]
-[first(range(.)), last(range(.)), nth(0; range(.)), nth(5; range(.)), try nth(-1; range(.)) catch .]
+[first(range(.)), last(range(.))]
10
-[0,9,0,5,"nth doesn't support negative indices"]
+[0,9]
+
+[nth(0,5,9,10,15; range(.)), try nth(-1; range(.)) catch .]
+10
+[0,5,9,"nth doesn't support negative indices"]
# Check that first(g) does not extract more than one value from g
first(1,error("foo"))