Upstream itchyny/gojq state of the touched files before a0fd150fb8
This commit is contained in:
1 parent
af32cf4c58
commit
33d02f2fdb
4 files changed
+82
-899
No files matched your search
+3
-397
@@ -710,27 +710,6 @@
|
||||
error: |
|
||||
expected a number for indexing an array but got: boolean (true)
|
||||
|
||||
- name: indexing number literal error
|
||||
args:
|
||||
- '-1[0]'
|
||||
input: 'null'
|
||||
error: |
|
||||
expected an array but got: number (1)
|
||||
|
||||
- name: slicing number literal error
|
||||
args:
|
||||
- '1 - -1[1:]'
|
||||
input: 'null'
|
||||
error: |
|
||||
expected an array but got: number (1)
|
||||
|
||||
- name: indexing by indexed number literal error
|
||||
args:
|
||||
- '.[1[0]]'
|
||||
input: '[0, 1]'
|
||||
error: |
|
||||
expected an array but got: number (1)
|
||||
|
||||
- name: array slicing start error
|
||||
args:
|
||||
- '.[[]:0]'
|
||||
@@ -1346,33 +1325,6 @@
|
||||
expected: |
|
||||
9223372036854775808
|
||||
|
||||
- name: abs function against non-numbers
|
||||
args:
|
||||
- -c
|
||||
- 'abs'
|
||||
input: |
|
||||
""
|
||||
"-42"
|
||||
[]
|
||||
[1,-2]
|
||||
{}
|
||||
{"a":-1}
|
||||
expected: |
|
||||
""
|
||||
"-42"
|
||||
[]
|
||||
[1,-2]
|
||||
{}
|
||||
{"a":-1}
|
||||
|
||||
- name: abs function error
|
||||
args:
|
||||
- 'abs'
|
||||
input: 'null true'
|
||||
error: |
|
||||
cannot negate: null
|
||||
cannot negate: boolean (true)
|
||||
|
||||
- name: length function
|
||||
args:
|
||||
- 'length'
|
||||
@@ -2478,17 +2430,6 @@
|
||||
["b"]
|
||||
[]
|
||||
|
||||
- name: split/1 function error
|
||||
args:
|
||||
- -c
|
||||
- 'try split(",") catch ., try split(1) catch .'
|
||||
input: '1 "a"'
|
||||
expected: |
|
||||
"split(\",\") cannot be applied to: number (1)"
|
||||
"split(1) cannot be applied to: number (1)"
|
||||
["a"]
|
||||
"split(1) cannot be applied to: string (\"a\")"
|
||||
|
||||
- name: join function
|
||||
args:
|
||||
- 'join(",")'
|
||||
@@ -3408,13 +3349,6 @@
|
||||
expected: |
|
||||
[5,5,false,3,3,[null,false],null,false]
|
||||
|
||||
- name: optional operator with alternative operator
|
||||
args:
|
||||
- '.a ?// 1'
|
||||
input: 'null'
|
||||
expected: |
|
||||
1
|
||||
|
||||
- name: condition
|
||||
args:
|
||||
- 'if . then . else [.] end'
|
||||
@@ -3630,29 +3564,6 @@
|
||||
expected: |
|
||||
5
|
||||
|
||||
- name: reduce with destructuring alternative operator
|
||||
args:
|
||||
- 'reduce .[] as [$i,$j] ?// {$i,$j} (0; . + $i * $j)'
|
||||
input: '[[1,2], {"i":3,"j":4}, [5,6]]'
|
||||
expected: |
|
||||
44
|
||||
|
||||
- name: reduce with destructuring alternative operator resetting variables
|
||||
args:
|
||||
- -c
|
||||
- 'reduce .[] as [$a] ?// {$b} ?// $c ([]; . + [[$a, $b, $c]])'
|
||||
input: '[{"b":1}, [2], 3, [4]]'
|
||||
expected: |
|
||||
[[null,1,null],[2,null,null],[null,null,3],[4,null,null]]
|
||||
|
||||
- name: reduce with destructuring alternative operator and error backtrack
|
||||
args:
|
||||
- -c
|
||||
- 'reduce .[] as [$a] ?// $a ([]; . + [if $a == 2 then error else $a end])'
|
||||
input: '[[1], [2], [3]]'
|
||||
expected: |
|
||||
[1,[2],3]
|
||||
|
||||
- name: reduce null
|
||||
args:
|
||||
- 'reduce . as $n (.; .)'
|
||||
@@ -3731,68 +3642,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)'
|
||||
@@ -3822,37 +3671,6 @@
|
||||
-1
|
||||
-4
|
||||
|
||||
- name: foreach with destructuring alternative operator
|
||||
args:
|
||||
- 'foreach .[] as [$i,$j] ?// {$i,$j} (0; . + $i * $j)'
|
||||
input: '[[1,2], {"i":3,"j":4}, [5,6]]'
|
||||
expected: |
|
||||
2
|
||||
14
|
||||
44
|
||||
|
||||
- name: foreach with destructuring alternative operator resetting variables
|
||||
args:
|
||||
- -c
|
||||
- 'foreach .[] as [$a] ?// {$b} ?// $c (null; [$a, $b, $c])'
|
||||
input: '[{"b":1}, [2], 3, [4]]'
|
||||
expected: |
|
||||
[null,1,null]
|
||||
[2,null,null]
|
||||
[null,null,3]
|
||||
[4,null,null]
|
||||
|
||||
- name: foreach with destructuring alternative operator and error backtrack in extract
|
||||
args:
|
||||
- -c
|
||||
- 'foreach .[] as {$a} ?// [$a] ?// $a (null; $a; if 1 < . and . < 4 then error else . end)'
|
||||
input: '[[1], [2], {"a":3}, 4]'
|
||||
expected: |
|
||||
1
|
||||
[2]
|
||||
{"a":3}
|
||||
4
|
||||
|
||||
- name: foreach with iterator in update
|
||||
args:
|
||||
- 'foreach .[] as $i (1; ., . + $i, range(.))'
|
||||
@@ -4677,17 +4495,6 @@
|
||||
[-3,-3,-2,-1,-1,-0,-0,0,0,0,0,1,1,2,3,3]
|
||||
[3.7,3.3,2.5,1.7,1,0.7,0.3,0,0.3,0.5,0.7,1,1.7,2.5,3.3,3.7]
|
||||
|
||||
- name: math functions against large number literals
|
||||
args:
|
||||
- -c
|
||||
- '[floor, ceil, sqrt, exp10]'
|
||||
input: |
|
||||
1e1000
|
||||
-1e1000
|
||||
expected: |
|
||||
[1.7976931348623157e+308,1.7976931348623157e+308,1.7976931348623157e+308,1.7976931348623157e+308]
|
||||
[-1.7976931348623157e+308,-1.7976931348623157e+308,null,0]
|
||||
|
||||
- name: round, nearbyint, rint functions
|
||||
args:
|
||||
- -c
|
||||
@@ -6068,7 +5875,7 @@
|
||||
args:
|
||||
- -c
|
||||
- 'gmtime, localtime | map(. * 1000000 | floor / 1000000)'
|
||||
input: '1500000000 1567890123.456 1600000000.111 -1 -0.5 0.5'
|
||||
input: '1500000000 1567890123.456 1600000000.111'
|
||||
expected: | # UTC-7 (TZ=Etc/GMT+7)
|
||||
[2017,6,14,2,40,0,5,194]
|
||||
[2017,6,13,19,40,0,4,193]
|
||||
@@ -6076,12 +5883,6 @@
|
||||
[2019,8,7,14,2,3.456,6,249]
|
||||
[2020,8,13,12,26,40.111,0,256]
|
||||
[2020,8,13,5,26,40.111,0,256]
|
||||
[1969,11,31,23,59,59,3,364]
|
||||
[1969,11,31,16,59,59,3,364]
|
||||
[1969,11,31,23,59,59.5,3,364]
|
||||
[1969,11,31,16,59,59.5,3,364]
|
||||
[1970,0,1,0,0,0.5,4,0]
|
||||
[1969,11,31,17,0,0.5,3,364]
|
||||
|
||||
- name: mktime, strftime, strflocaltime, todate functions
|
||||
args:
|
||||
@@ -6093,7 +5894,6 @@
|
||||
[2020,8,13,12,26,40.111,0,256]
|
||||
[2024,7,20]
|
||||
[2025]
|
||||
[1969,11,31,23,59,59.5,3,364]
|
||||
expected: |
|
||||
[2017,6,14,2,40,0,5,194]
|
||||
2017-07-14T02:40:00Z
|
||||
@@ -6130,105 +5930,15 @@
|
||||
2024-12-31T00:00:00Z
|
||||
2024-12-30T17:00:00-0700
|
||||
2024-12-31T00:00:00Z
|
||||
[1969,11,31,23,59,59.5,3,364]
|
||||
1969-12-31T23:59:59Z
|
||||
1969-12-31T23:59:59-0700
|
||||
-0.5
|
||||
1969-12-31T23:59:59Z
|
||||
1969-12-31T16:59:59-0700
|
||||
1969-12-31T23:59:59Z
|
||||
|
||||
- name: date functions with fractional seconds
|
||||
args:
|
||||
- -r
|
||||
- 'mktime, strftime("%Y-%m-%dT%H:%M:%S.%fZ"), strflocaltime("%Y-%m-%dT%H:%M:%S.%f%z")'
|
||||
input: |
|
||||
[1970,0,1,0,0,-0.5]
|
||||
[1970,0,1,0,0,-1.25]
|
||||
[1970,0,1,0,0,-60.25]
|
||||
[1970,0,1,0,0,-1]
|
||||
[1970,0,1,0,0,0]
|
||||
[1970,0,1,0,0,0.5]
|
||||
[1970,0,1,0,0,60.25]
|
||||
expected: | # UTC-7 (TZ=Etc/GMT+7)
|
||||
-0.5
|
||||
1969-12-31T23:59:59.500000Z
|
||||
1969-12-31T23:59:59.500000-0700
|
||||
-1.25
|
||||
1969-12-31T23:59:58.750000Z
|
||||
1969-12-31T23:59:58.750000-0700
|
||||
-60.25
|
||||
1969-12-31T23:58:59.750000Z
|
||||
1969-12-31T23:58:59.750000-0700
|
||||
-1
|
||||
1969-12-31T23:59:59.000000Z
|
||||
1969-12-31T23:59:59.000000-0700
|
||||
0
|
||||
1970-01-01T00:00:00.000000Z
|
||||
1970-01-01T00:00:00.000000-0700
|
||||
0.5
|
||||
1970-01-01T00:00:00.500000Z
|
||||
1970-01-01T00:00:00.500000-0700
|
||||
60.25
|
||||
1970-01-01T00:01:00.250000Z
|
||||
1970-01-01T00:01:00.250000-0700
|
||||
|
||||
- name: mktime after subtracting fractional seconds
|
||||
args:
|
||||
- 'gmtime | .[5] -= 0.5 | mktime'
|
||||
input: '0 60 86400 -60'
|
||||
expected: |
|
||||
-0.5
|
||||
59.5
|
||||
86399.5
|
||||
-60.5
|
||||
|
||||
- name: date functions with non-finite or out of range epoch timestamps
|
||||
args:
|
||||
- -n
|
||||
- '[infinite, -infinite, nan, 1e19, -1e19, 9223372036854775807, -9223372036854775808] | .[] | try gmtime catch .'
|
||||
expected: |
|
||||
"gmtime cannot be applied to 1.7976931348623157e+308: number of seconds is out of range"
|
||||
"gmtime cannot be applied to -1.7976931348623157e+308: number of seconds is out of range"
|
||||
"gmtime cannot be applied to null: number of seconds is out of range"
|
||||
"gmtime cannot be applied to 10000000000000000000: number of seconds is out of range"
|
||||
"gmtime cannot be applied to -10000000000000000000: number of seconds is out of range"
|
||||
"gmtime cannot be applied to 9223372036854775807: number of seconds is out of range"
|
||||
"gmtime cannot be applied to -9223372036854775808: number of seconds is out of range"
|
||||
|
||||
- name: date functions with out of range numbers in the array
|
||||
args:
|
||||
- -n
|
||||
- '[[infinite,0,1], [nan,0,1], [1e19,0,1], [0,1e19,1], [2001,0,1,0,0,infinite], [2001,0,1,0,0,nan], [2001,0,1,0,0,1e19], [9223372036854775807,0,1], ["x",0,1]] | .[] | try mktime catch .'
|
||||
expected: |
|
||||
"mktime cannot be applied to [1.7976931348623157e+308,0,1]: number is out of range"
|
||||
"mktime cannot be applied to [null,0,1]: number is out of range"
|
||||
"mktime cannot be applied to [10000000000000000000,0,1]: number is out of range"
|
||||
"mktime cannot be applied to [0,10000000000000000000,1]: number is out of range"
|
||||
"mktime cannot be applied to [2001,0,1,0,0,1.797693134 ...]: number is out of range"
|
||||
"mktime cannot be applied to [2001,0,1,0,0,null]: number is out of range"
|
||||
"mktime cannot be applied to [2001,0,1,0,0,10000000000 ...]: number is out of range"
|
||||
"mktime cannot be applied to [9223372036854775807,0,1]: number is out of range"
|
||||
"mktime cannot be applied to [\"x\",0,1]: expected an array of 8 numbers"
|
||||
|
||||
- name: strftime function with out of range datetime
|
||||
args:
|
||||
- -n
|
||||
- 'try (infinite | todate) catch ., try ([1e19,0,1] | strftime("%Y")) catch .'
|
||||
expected: |
|
||||
"strftime(\"%Y-%m-%dT%H:%M:%SZ\") cannot be applied to 1.7976931348623157e+308: number of seconds is out of range"
|
||||
"strftime(\"%Y\") cannot be applied to [10000000000000000000,0,1]: number is out of range"
|
||||
|
||||
- name: strptime, fromdate functions
|
||||
args:
|
||||
- -c
|
||||
- 'strptime("%Y-%m-%dT%H:%M:%S%z")? // strptime("%Y-%m-%dT%H:%M:%S.%f%z"), fromdate?'
|
||||
- 'strptime("%Y-%m-%dT%H:%M:%S%z"), fromdate'
|
||||
input: |
|
||||
"2017-07-14T02:40:00Z"
|
||||
"2019-09-08T06:02:03+0900"
|
||||
"2020-09-13T07:26:40-05:00"
|
||||
"1969-12-31T23:59:59.5+0000"
|
||||
"2345-01-02T03:04:05.678901+0000"
|
||||
expected: |
|
||||
[2017,6,14,2,40,0,5,194]
|
||||
1500000000
|
||||
@@ -6236,8 +5946,6 @@
|
||||
1567890123
|
||||
[2020,8,13,12,26,40,0,256]
|
||||
1600000000
|
||||
[1969,11,31,23,59,59.5,3,364]
|
||||
[2345,0,2,3,4,5.678901,2,1]
|
||||
|
||||
- name: strftime, strptime functions
|
||||
args:
|
||||
@@ -6953,49 +6661,6 @@
|
||||
"aabcABC☆★☆ABCabc"
|
||||
"abcABC☆★☆ABCabc"
|
||||
|
||||
- name: match function with empty matches
|
||||
args:
|
||||
- -c
|
||||
- '[match("a*"; "g").offset], [scan("[a-z]*")], gsub("[0-9]*"; "#"), split("-*"; ""), [splits("\\s*")]'
|
||||
input: '"a1b-c d"'
|
||||
expected: |
|
||||
[0,1,2,3,4,5,6,7]
|
||||
["a","","b","","c","","d",""]
|
||||
"#a##b#-#c# #d#"
|
||||
["","a","1","b","","c"," ","d",""]
|
||||
["","a","1","b","-","c","","d",""]
|
||||
|
||||
- name: match function with empty matches and assertions
|
||||
args:
|
||||
- -c
|
||||
- 'gsub("(?m)^a*"; "#"), gsub("\\ba*"; "#"), gsub("(^|-)a*"; "#"), gsub("[a-z]*\\b"; "#")'
|
||||
input: '"a-a b"'
|
||||
expected: |
|
||||
"#-a b"
|
||||
"##-## #b#"
|
||||
"## b"
|
||||
"##-## ##"
|
||||
|
||||
- name: match function with empty matches and captures
|
||||
args:
|
||||
- -c
|
||||
- '[scan("(x)?a*")], [match("(a|)"; "g") | [.offset, .captures[0].offset]], [scan("[^a]*"; "i")]'
|
||||
input: '"1a-A"'
|
||||
expected: |
|
||||
[[null],[null],[null],[null],[null]]
|
||||
[[0,0],[1,1],[2,2],[3,3],[4,4]]
|
||||
["1","","-","",""]
|
||||
|
||||
- name: match function with empty matches against multibyte characters
|
||||
args:
|
||||
- -c
|
||||
- '[scan("[☆★]*")], [match("[☆★]*"; "g").offset], gsub("[☆★]*"; "#")'
|
||||
input: '"☆★1☆★"'
|
||||
expected: |
|
||||
["☆★","","☆★",""]
|
||||
[0,2,3,5]
|
||||
"##1##"
|
||||
|
||||
- name: INDEX function
|
||||
args:
|
||||
- -c
|
||||
@@ -7293,17 +6958,6 @@
|
||||
{"a":3}
|
||||
{"a":4}
|
||||
|
||||
- name: destructuring alternative operator with break in try
|
||||
args:
|
||||
- -c
|
||||
- 'first((. as {$a} ?// [$a] ?// $a | {$a})?)'
|
||||
input: '[1] [2] {"a":3} 4'
|
||||
expected: |
|
||||
{"a":1}
|
||||
{"a":2}
|
||||
{"a":3}
|
||||
{"a":4}
|
||||
|
||||
- name: destructuring alternative operator with halt
|
||||
args:
|
||||
- -c
|
||||
@@ -7323,28 +6977,6 @@
|
||||
[1]
|
||||
exit_code: 5
|
||||
|
||||
- name: destructuring alternative operator with halt_error in try
|
||||
args:
|
||||
- -c
|
||||
- 'try (. as {$a} ?// [$a] ?// $a | {$a}, halt_error)'
|
||||
input: '[1]'
|
||||
expected: |
|
||||
{"a":1}
|
||||
error: |
|
||||
[1]
|
||||
exit_code: 5
|
||||
|
||||
- name: destructuring alternative operator resets variables of later alternatives
|
||||
args:
|
||||
- -c
|
||||
- '.[] as [$a] ?// {$b} ?// $c | [$a, $b, $c]'
|
||||
input: '[{"b":1}, [2], 3, [4]]'
|
||||
expected: |
|
||||
[null,1,null]
|
||||
[2,null,null]
|
||||
[null,null,3]
|
||||
[4,null,null]
|
||||
|
||||
- name: destructuring alternative operator with multiple variables
|
||||
args:
|
||||
- -c
|
||||
@@ -8008,7 +7640,7 @@
|
||||
[["c"],3]
|
||||
[["c"]]
|
||||
|
||||
- name: stream option with unterminated input after a comma
|
||||
- name: stream option with unterminated input
|
||||
args:
|
||||
- -c
|
||||
- --stream
|
||||
@@ -8021,21 +7653,6 @@
|
||||
{"a":1,
|
||||
^ unexpected EOF
|
||||
|
||||
- name: stream option with unterminated input after a value
|
||||
args:
|
||||
- -c
|
||||
- --stream
|
||||
- '.'
|
||||
input: '[1,[2,3'
|
||||
expected: |
|
||||
[[0],1]
|
||||
[[1,0],2]
|
||||
[[1,1],3]
|
||||
error: |
|
||||
invalid json: <stdin>
|
||||
[1,[2,3
|
||||
^ unexpected EOF
|
||||
|
||||
- name: yaml input option
|
||||
args:
|
||||
- --yaml-input
|
||||
@@ -8205,17 +7822,6 @@
|
||||
2 | bar: ]
|
||||
^ did not find expected node content
|
||||
|
||||
- name: yaml input option error with multibyte characters
|
||||
args:
|
||||
- --yaml-input
|
||||
- '.'
|
||||
input: |
|
||||
{123: 4, 123: 5}
|
||||
error: |
|
||||
invalid yaml: <stdin>:1
|
||||
1 | {123: 4, 123: 5}
|
||||
^ mapping key "123" already defined at line 1
|
||||
|
||||
- name: yaml input option multiple errors
|
||||
args:
|
||||
- --yaml-input
|
||||
|
||||
Reference in new issue
Block a user