diff options
author | Nicolas Williams <nico@cryptonector.com> | 2017-02-20 19:15:05 -0600 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2017-03-26 05:36:22 -0500 |
commit | 2421dfb8437b7b9e2f9965c9f7d7999bda8d54b7 (patch) | |
tree | b91452cfe284010080432816f76adbede122ac6e /tests | |
parent | 94035be3fa80ea201e82ee4b59ee6434357732f6 (diff) |
Add more destructuring tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jq.test | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test index 2882d9c4..48def7c8 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -715,6 +715,18 @@ reduce . as $n (.; .) null null +# Destructuring +. as {$a, b: [$c, {$d}]} | [$a, $c, $d] +{"a":1, "b":[2,{"d":3}]} +[1,2,3] + +# Destructuring with alternation +.[] | . as {$a, b: [$c, {$d}]} ?// [$a, {$b}, $e] ?// $f | [$a, $b, $c, $d, $e, $f] +[{"a":1, "b":[2,{"d":3}]}, [4, {"b":5, "c":6}, 7, 8, 9], "foo"] +[1, null, 2, 3, null, null] +[4, 5, null, null, 7, null] +[null, null, null, null, null, "foo"] + . as $dot|any($dot[];not) [1,2,3,4,true,false,1,2,3,4,5] true |