Upstream itchyny/gojq state of the touched files before 7290ed0ca2

This commit is contained in:
upstream committed 2026-09-04 08:21:35 +02:00
1 parent 6d290823f7
commit c5274c6af4
4 files changed
+57 -543

No files matched your search

+2 -145
View File
@@ -2407,29 +2407,6 @@
"/a,b/c/d/e,f/"
",/ /a/,/b/,/ /c/,/ /d/,/ /e/,/f/,/ "
- name: split/1 function against empty string
args:
- -c
- '.[] as $t | .[] as $s | $s | split($t)'
input: '["abc", "a", "b", ""]'
expected: |
["",""]
["a"]
["b"]
[]
["","bc"]
["",""]
["b"]
[]
["a","c"]
["a"]
["",""]
[]
["a","b","c"]
["a"]
["b"]
[]
- name: join function
args:
- 'join(",")'
@@ -3608,16 +3585,6 @@
expected: |
8
- name: reduce with assignment of multiple paths in update
args:
- -c
- 'reduce (1,2) as $i (.; (.[0], .[.[0]]) = $i),
reduce (1,2) as $i (.; (.[0], .[.[0]]) |= $i)'
input: '[0,0,0]'
expected: |
[2,2,0]
[2,2,0]
- name: reduce with query in start
args:
- 'reduce range(5) as $x (range(3); . + $x)'
@@ -3642,68 +3609,6 @@
expected: |
[[1,1],[1]]
- name: reduce with assignment in update
args:
- -c
- 'reduce range(3) as $i ({}; .[$i|tostring] = {}),
reduce range(3) as $i ({}; .a[$i|tostring] = $i),
reduce range(3) as $i ([]; .[$i] = $i),
reduce range(3) as $i ({}; .[$i|tostring] += 1)'
input: 'null'
expected: |
{"0":{},"1":{},"2":{}}
{"a":{"0":0,"1":1,"2":2}}
[0,1,2]
{"0":1,"1":1,"2":1}
- name: reduce with assignment of the accumulated value
args:
- -c
- 'reduce range(3) as $i ({}; .a = .),
reduce range(3) as $i ({}; .a = {v: .}),
reduce range(3) as $i ({}; . as $p | .a = $i | .b = $p)'
input: 'null'
expected: |
{"a":{"a":{"a":{}}}}
{"a":{"v":{"a":{"v":{"a":{"v":{}}}}}}}
{"a":2,"b":{"a":1,"b":{"a":0,"b":{}}}}
- name: reduce with assignment of multiple values
args:
- -c
- 'reduce range(2) as $i ({"k":"k"}; .[.k] = ("x","y")),
reduce range(2) as $i ({}; (.a = 1), (.b = 2))'
input: 'null'
expected: |
{"k":"y","y":"y"}
{"b":2}
- name: reduce with assignment of a shared value
args:
- -c
- '{"a":1} as $x | reduce range(2) as $i ({}; .[$i|tostring] = $x) |
[(.["0"].a = 9), $x]'
input: 'null'
expected: |
[{"0":{"a":9},"1":{"a":1}},{"a":1}]
- name: reduce with assignment result reused
args:
- -c
- 'reduce range(3) as $i ({}; .[$i|tostring] = $i) as $r |
[($r | .["0"] = 9), $r]'
input: 'null'
expected: |
[{"0":9,"1":1,"2":2},{"0":0,"1":1,"2":2}]
- name: foreach with assignment in update
args:
- -c
- '[foreach range(3) as $i ({}; .[$i|tostring] = $i)]'
input: 'null'
expected: |
[{"0":0},{"0":0,"1":1},{"0":0,"1":1,"2":2}]
- name: foreach iterator
args:
- 'foreach range(5) as $item (0; $item)'
@@ -5084,46 +4989,6 @@
expected: |
{"a":[{},{"b":[1,2,3]}]}
- name: getpath function against string
args:
- -c
- '[getpath([{"start":1,"end":3}]), getpath([{"start":-2,"end":null}]), getpath([1]), getpath([])]'
input: '"abcde"'
expected: |
["bc","de","b","abcde"]
- name: getpath function against string in a container
args:
- -c
- 'getpath(["a",{"start":0,"end":2}]), getpath(["a",1])'
input: '{"a":"abc"}'
expected: |
"ab"
"b"
- name: getpath function against string round trip with path function
args:
- -c
- '[getpath(path(.[1:3])), getpath(path(.[1]))]'
input: '"abcde"'
expected: |
["bc","b"]
- name: getpath function against string round trip in a container
args:
- -c
- '. as $d | [path(.a[0:2]), path(.b[1])] | map(. as $p | $d | getpath($p))'
input: '{"a":"abc","b":"xyz"}'
expected: |
["ab","y"]
- name: getpath function against string with object key
args:
- 'getpath(["k"])'
input: '"abc"'
error: |
getpath(["k"]) cannot be applied to "abc": expected an object but got: string ("abc")
- name: getpath function error
args:
- 'getpath(["a",1,"b","c"])'
@@ -5156,9 +5021,9 @@
expected: |
{"a":[{"b":5}]}
{"a":[{"b":5}],"b":0}
"getpath([\"a\",0,\"b\"]) cannot be applied to {\"a\":0}: expected an array but got: number (0)"
"getpath([\"a\",0,\"b\"]) cannot be applied to: object ({\"a\":0})"
{"a":[{"b":5}]}
"getpath([\"a\",0,\"b\"]) cannot be applied to {\"a\":[0,1]}: expected an object but got: number (0)"
"getpath([\"a\",0,\"b\"]) cannot be applied to: object ({\"a\":[0,1]})"
"getpath([\"a\",0,\"b\"]) cannot be applied to {\"a\":{\"b\":1}}: expected an array but got: object ({\"b\":1})"
{"a":[{"b":5}]}
{"a":[{"b":5,"c":3}]}
@@ -5572,14 +5437,6 @@
expected: |
{"a":{"p":{"b":{"p":1,"q":1},"z":{"p":null,"q":null}},"q":{"b":{"p":1,"q":1}}}}
- name: update-assignment operator against nested object with overlapping paths
args:
- -c
- '(.a.b.c,.a,.a.p.b.z) |= {p: ., q: .}'
input: '{"a":{"b":{"c":1}}}'
expected: |
{"a":{"p":{"b":{"c":{"p":1,"q":1},"z":{"p":null,"q":null}}},"q":{"b":{"c":{"p":1,"q":1}}}}}
- name: update-assignment operator with optional operator
args:
- -c