diff options
Diffstat (limited to 'tests/all.test')
-rw-r--r-- | tests/all.test | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/all.test b/tests/all.test index 4477ec25..67b80763 100644 --- a/tests/all.test +++ b/tests/all.test @@ -247,15 +247,35 @@ null 1 [1,2,4,8,16,32,64] -[while(.<100; .*2|if . > 10 then break else . end)] +[label | while(.<100; .*2|if . > 10 then break else . end)] 1 [1,2,4,8] +[(label $here | .[] | if .>1 then break $here else . end), "hi!"] +[0,1,2] +[0,1,"hi!"] + +[(label $here | .[] | if .>1 then break $here else . end), "hi!"] +[0,2,1] +[0,"hi!"] + +(label | (label | 2 | break2)), 1 +null +1 + +%%FAIL +break +jq: error: break used outside labeled control structure + +%%FAIL +. as $foo | break $foo +jq: error: *label-foo/0 is not defined + [.[]|[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]] [1,2,3,4,5] [1,2,6,24,120] -[foreach .[] as $item ([3, null]; if .[0] < 1 then break else [.[0] -1, $item] end; .[1])] +[label | foreach .[] as $item ([3, null]; if .[0] < 1 then break else [.[0] -1, $item] end; .[1])] [11,22,33,44,55,66,77,88,99] [11,22,33] |