diff options
author | itchyny <itchyny@cybozu.co.jp> | 2023-07-07 13:54:27 +0900 |
---|---|---|
committer | Nico Williams <nico@cryptonector.com> | 2023-07-07 20:11:10 -0500 |
commit | 371abc73ba97dfd49c3affa330236eb41150b8dd (patch) | |
tree | 539cf62718236455a988b2411adfa64e1a666f5e /tests | |
parent | cd8898d5b95cbf082da000096ff5befe191329e0 (diff) |
Fix deletion using assigning empty against arrays (fix #2051)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jq.test | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test index 308a4e6b..a4b8d5fd 100644 --- a/tests/jq.test +++ b/tests/jq.test @@ -1044,6 +1044,19 @@ def inc(x): x |= .+1; inc(.[].a) {"a":[{"b":5}]} {"a":[{"c":3,"b":5}]} +# #2051, deletion using assigning empty against arrays +(.[] | select(. >= 2)) |= empty +[1,5,3,0,7] +[1,0] + +.[] |= select(. % 2 == 0) +[0,1,2,3,4,5] +[0,2,4] + +.foo[1,4,2,3] |= empty +{"foo":[0,1,2,3,4,5]} +{"foo":[0,5]} + .[2][3] = 1 [4] [4, null, [null, null, null, 1]] |