@port-labs/jq-node-bindings 0.0.14 → 0.0.15-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/README.md +6 -1
  2. package/binding.gyp +41 -19
  3. package/configure +1 -1
  4. package/deps/jq/.gitattributes +12 -0
  5. package/deps/jq/AUTHORS +149 -43
  6. package/deps/jq/COPYING +75 -1
  7. package/deps/jq/ChangeLog +2 -2
  8. package/deps/jq/Makefile.am +106 -65
  9. package/deps/jq/NEWS.md +391 -0
  10. package/deps/jq/README.md +54 -52
  11. package/deps/jq/SECURITY.md +7 -0
  12. package/deps/jq/compile-ios.sh +106 -102
  13. package/deps/jq/configure.ac +72 -59
  14. package/deps/jq/docs/Pipfile +14 -0
  15. package/deps/jq/docs/Pipfile.lock +415 -0
  16. package/deps/jq/docs/README.md +15 -14
  17. package/deps/jq/docs/build_manpage.py +251 -0
  18. package/deps/jq/docs/build_mantests.py +21 -0
  19. package/deps/jq/docs/build_website.py +95 -0
  20. package/deps/jq/docs/content/download/default.yml +249 -0
  21. package/deps/jq/docs/content/index.yml +83 -0
  22. package/deps/jq/docs/content/{3.manual/v1.6 → manual/dev}/manual.yml +992 -452
  23. package/deps/jq/docs/content/{3.manual → manual}/v1.3/manual.yml +105 -116
  24. package/deps/jq/docs/content/{3.manual → manual}/v1.4/manual.yml +122 -129
  25. package/deps/jq/docs/content/{3.manual → manual}/v1.5/manual.yml +313 -262
  26. package/deps/jq/docs/content/{3.manual → manual/v1.6}/manual.yml +407 -332
  27. package/deps/jq/docs/content/manual/v1.7/manual.yml +3697 -0
  28. package/deps/jq/docs/content/tutorial/default.yml +337 -0
  29. package/deps/jq/docs/manual_schema.yml +60 -0
  30. package/deps/jq/docs/public/css/style.css +99 -0
  31. package/deps/jq/docs/public/icon.png +0 -0
  32. package/deps/jq/docs/public/icon.svg +1 -0
  33. package/deps/jq/docs/public/jq.svg +1 -0
  34. package/deps/jq/docs/public/js/manual-search.js +31 -49
  35. package/deps/jq/docs/templates/default.html.j2 +31 -0
  36. package/deps/jq/docs/templates/index.html.j2 +58 -0
  37. package/deps/jq/docs/templates/manual.html.j2 +120 -0
  38. package/deps/jq/docs/templates/shared/_footer.html.j2 +14 -0
  39. package/deps/jq/docs/templates/shared/_head.html.j2 +23 -0
  40. package/deps/jq/docs/templates/shared/_navbar.html.j2 +40 -0
  41. package/deps/jq/docs/validate_manual_schema.py +19 -0
  42. package/deps/jq/jq.1.prebuilt +1102 -294
  43. package/deps/jq/jq.spec +2 -3
  44. package/deps/jq/libjq.pc.in +11 -0
  45. package/deps/jq/m4/ax_pthread.m4 +522 -0
  46. package/deps/jq/modules/oniguruma/.travis.yml +17 -0
  47. package/deps/jq/modules/oniguruma/CMakeLists.txt +206 -41
  48. package/deps/jq/modules/oniguruma/COPYING +23 -25
  49. package/deps/jq/modules/oniguruma/HISTORY +368 -23
  50. package/deps/jq/modules/oniguruma/Makefile.am +61 -7
  51. package/deps/jq/modules/oniguruma/README +34 -20
  52. package/deps/jq/modules/oniguruma/README.md +106 -33
  53. package/deps/jq/modules/oniguruma/README_japanese +183 -0
  54. package/deps/jq/modules/oniguruma/autogen.sh +9 -0
  55. package/deps/jq/modules/oniguruma/cmake/Config.cmake.in +4 -0
  56. package/deps/jq/modules/oniguruma/configure.ac +66 -55
  57. package/deps/jq/modules/oniguruma/doc/API +485 -42
  58. package/deps/jq/modules/oniguruma/doc/API.ja +732 -293
  59. package/deps/jq/modules/oniguruma/doc/CALLOUTS.API +397 -0
  60. package/deps/jq/modules/oniguruma/doc/CALLOUTS.API.ja +393 -0
  61. package/deps/jq/modules/oniguruma/doc/CALLOUTS.BUILTIN +95 -0
  62. package/deps/jq/modules/oniguruma/doc/CALLOUTS.BUILTIN.ja +93 -0
  63. package/deps/jq/modules/oniguruma/doc/FAQ +3 -3
  64. package/deps/jq/modules/oniguruma/doc/FAQ.ja +8 -8
  65. package/deps/jq/modules/oniguruma/doc/RE +223 -63
  66. package/deps/jq/modules/oniguruma/doc/RE.ja +420 -265
  67. package/deps/jq/modules/oniguruma/doc/SYNTAX.md +1091 -0
  68. package/deps/jq/modules/oniguruma/doc/UNICODE_PROPERTIES +840 -697
  69. package/deps/jq/modules/oniguruma/harnesses/ascii_compatible.dict +113 -0
  70. package/deps/jq/modules/oniguruma/harnesses/base.c +749 -0
  71. package/deps/jq/modules/oniguruma/harnesses/deluxe.c +206 -0
  72. package/deps/jq/modules/oniguruma/harnesses/dict_conv.py +72 -0
  73. package/deps/jq/modules/oniguruma/harnesses/fuzzer.options +2 -0
  74. package/deps/jq/modules/oniguruma/harnesses/libfuzzer-onig.cpp +45 -0
  75. package/deps/jq/modules/oniguruma/harnesses/regset.c +392 -0
  76. package/deps/jq/modules/oniguruma/index.html +16 -5
  77. package/deps/jq/modules/oniguruma/index_ja.html +16 -5
  78. package/deps/jq/modules/oniguruma/make_win.bat +5 -0
  79. package/deps/jq/modules/oniguruma/make_win32.bat +5 -3
  80. package/deps/jq/modules/oniguruma/make_win64.bat +5 -3
  81. package/deps/jq/modules/oniguruma/onig-config.cmake.in +80 -0
  82. package/deps/jq/modules/oniguruma/onig-config.in +1 -1
  83. package/deps/jq/modules/oniguruma/oniguruma.pc.cmake.in +1 -1
  84. package/deps/jq/modules/oniguruma/oniguruma.pc.in +0 -1
  85. package/deps/jq/modules/oniguruma/sample/CMakeLists.txt +9 -2
  86. package/deps/jq/modules/oniguruma/sample/Makefile.am +24 -5
  87. package/deps/jq/modules/oniguruma/sample/bug_fix.c +13 -51
  88. package/deps/jq/modules/oniguruma/sample/callback_each_match.c +168 -0
  89. package/deps/jq/modules/oniguruma/sample/callout.c +268 -0
  90. package/deps/jq/modules/oniguruma/sample/count.c +125 -0
  91. package/deps/jq/modules/oniguruma/sample/crnl.c +6 -4
  92. package/deps/jq/modules/oniguruma/sample/echo.c +136 -0
  93. package/deps/jq/modules/oniguruma/sample/encode.c +53 -146
  94. package/deps/jq/modules/oniguruma/sample/listcap.c +18 -10
  95. package/deps/jq/modules/oniguruma/sample/names.c +10 -6
  96. package/deps/jq/modules/oniguruma/sample/posix.c +13 -2
  97. package/deps/jq/modules/oniguruma/sample/regset.c +95 -0
  98. package/deps/jq/modules/oniguruma/sample/scan.c +20 -6
  99. package/deps/jq/modules/oniguruma/sample/simple.c +8 -4
  100. package/deps/jq/modules/oniguruma/sample/sql.c +13 -8
  101. package/deps/jq/modules/oniguruma/sample/syntax.c +11 -10
  102. package/deps/jq/modules/oniguruma/sample/user_property.c +12 -7
  103. package/deps/jq/modules/oniguruma/src/Makefile.am +41 -15
  104. package/deps/jq/modules/oniguruma/src/Makefile.windows +196 -183
  105. package/deps/jq/modules/oniguruma/src/ascii.c +64 -7
  106. package/deps/jq/modules/oniguruma/src/big5.c +25 -15
  107. package/deps/jq/modules/oniguruma/src/config.h.cmake.in +7 -22
  108. package/deps/jq/modules/oniguruma/src/config.h.win32 +56 -84
  109. package/deps/jq/modules/oniguruma/src/config.h.win64 +56 -84
  110. package/deps/jq/modules/oniguruma/src/config.h.windows.in +62 -0
  111. package/deps/jq/modules/oniguruma/src/cp1251.c +14 -8
  112. package/deps/jq/modules/oniguruma/src/euc_jp.c +28 -30
  113. package/deps/jq/modules/oniguruma/src/euc_jp_prop.c +25 -32
  114. package/deps/jq/modules/oniguruma/src/euc_jp_prop.gperf +1 -2
  115. package/deps/jq/modules/oniguruma/src/euc_kr.c +27 -15
  116. package/deps/jq/modules/oniguruma/src/euc_tw.c +40 -17
  117. package/deps/jq/modules/oniguruma/src/gb18030.c +177 -119
  118. package/deps/jq/modules/oniguruma/src/gperf_fold_key_conv.py +12 -8
  119. package/deps/jq/modules/oniguruma/src/gperf_unfold_key_conv.py +8 -6
  120. package/deps/jq/modules/oniguruma/src/iso8859_1.c +92 -91
  121. package/deps/jq/modules/oniguruma/src/iso8859_10.c +13 -29
  122. package/deps/jq/modules/oniguruma/src/iso8859_11.c +4 -2
  123. package/deps/jq/modules/oniguruma/src/iso8859_13.c +13 -33
  124. package/deps/jq/modules/oniguruma/src/iso8859_14.c +13 -30
  125. package/deps/jq/modules/oniguruma/src/iso8859_15.c +13 -34
  126. package/deps/jq/modules/oniguruma/src/iso8859_16.c +13 -29
  127. package/deps/jq/modules/oniguruma/src/iso8859_2.c +13 -29
  128. package/deps/jq/modules/oniguruma/src/iso8859_3.c +13 -33
  129. package/deps/jq/modules/oniguruma/src/iso8859_4.c +13 -32
  130. package/deps/jq/modules/oniguruma/src/iso8859_5.c +16 -23
  131. package/deps/jq/modules/oniguruma/src/iso8859_6.c +4 -2
  132. package/deps/jq/modules/oniguruma/src/iso8859_7.c +14 -29
  133. package/deps/jq/modules/oniguruma/src/iso8859_8.c +4 -2
  134. package/deps/jq/modules/oniguruma/src/iso8859_9.c +13 -33
  135. package/deps/jq/modules/oniguruma/src/koi8.c +14 -27
  136. package/deps/jq/modules/oniguruma/src/koi8_r.c +12 -19
  137. package/deps/jq/modules/oniguruma/src/make_property.sh +21 -0
  138. package/deps/jq/modules/oniguruma/src/make_unicode_egcb.sh +7 -0
  139. package/deps/jq/modules/oniguruma/src/make_unicode_egcb_data.py +267 -0
  140. package/deps/jq/modules/oniguruma/src/make_unicode_fold.sh +25 -11
  141. package/deps/jq/modules/oniguruma/src/make_unicode_fold_data.py +206 -26
  142. package/deps/jq/modules/oniguruma/src/make_unicode_property.sh +19 -10
  143. package/deps/jq/modules/oniguruma/src/make_unicode_property_data.py +474 -375
  144. package/deps/jq/modules/oniguruma/src/make_unicode_wb.sh +7 -0
  145. package/deps/jq/modules/oniguruma/src/make_unicode_wb_data.py +267 -0
  146. package/deps/jq/modules/oniguruma/src/mktable.c +28 -24
  147. package/deps/jq/modules/oniguruma/src/onig_init.c +2 -2
  148. package/deps/jq/modules/oniguruma/src/oniggnu.h +7 -5
  149. package/deps/jq/modules/oniguruma/src/onigposix.h +40 -16
  150. package/deps/jq/modules/oniguruma/src/oniguruma.h +357 -107
  151. package/deps/jq/modules/oniguruma/src/regcomp.c +6214 -3933
  152. package/deps/jq/modules/oniguruma/src/regenc.c +197 -120
  153. package/deps/jq/modules/oniguruma/src/regenc.h +106 -63
  154. package/deps/jq/modules/oniguruma/src/regerror.c +112 -91
  155. package/deps/jq/modules/oniguruma/src/regexec.c +4876 -2010
  156. package/deps/jq/modules/oniguruma/src/regext.c +8 -8
  157. package/deps/jq/modules/oniguruma/src/reggnu.c +13 -17
  158. package/deps/jq/modules/oniguruma/src/regint.h +757 -491
  159. package/deps/jq/modules/oniguruma/src/regparse.c +7204 -3240
  160. package/deps/jq/modules/oniguruma/src/regparse.h +361 -218
  161. package/deps/jq/modules/oniguruma/src/regposerr.c +49 -9
  162. package/deps/jq/modules/oniguruma/src/regposix.c +106 -24
  163. package/deps/jq/modules/oniguruma/src/regsyntax.c +66 -13
  164. package/deps/jq/modules/oniguruma/src/regtrav.c +1 -1
  165. package/deps/jq/modules/oniguruma/src/regversion.c +6 -4
  166. package/deps/jq/modules/oniguruma/src/sjis.c +23 -52
  167. package/deps/jq/modules/oniguruma/src/sjis_prop.c +25 -32
  168. package/deps/jq/modules/oniguruma/src/sjis_prop.gperf +1 -2
  169. package/deps/jq/modules/oniguruma/src/st.c +248 -249
  170. package/deps/jq/modules/oniguruma/src/st.h +4 -5
  171. package/deps/jq/modules/oniguruma/src/unicode.c +869 -294
  172. package/deps/jq/modules/oniguruma/src/unicode_egcb_data.c +1419 -0
  173. package/deps/jq/modules/oniguruma/src/unicode_fold1_key.c +1829 -1300
  174. package/deps/jq/modules/oniguruma/src/unicode_fold2_key.c +32 -9
  175. package/deps/jq/modules/oniguruma/src/unicode_fold3_key.c +32 -9
  176. package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +1210 -984
  177. package/deps/jq/modules/oniguruma/src/unicode_property_data.c +22480 -15198
  178. package/deps/jq/modules/oniguruma/src/unicode_property_data_posix.c +1463 -591
  179. package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +1958 -1418
  180. package/deps/jq/modules/oniguruma/src/unicode_wb_data.c +1106 -0
  181. package/deps/jq/modules/oniguruma/src/utf16_be.c +90 -49
  182. package/deps/jq/modules/oniguruma/src/utf16_le.c +80 -49
  183. package/deps/jq/modules/oniguruma/src/utf32_be.c +14 -42
  184. package/deps/jq/modules/oniguruma/src/utf32_le.c +13 -40
  185. package/deps/jq/modules/oniguruma/src/utf8.c +33 -78
  186. package/deps/jq/modules/oniguruma/test/CMakeLists.txt +55 -0
  187. package/deps/jq/modules/oniguruma/test/Makefile.am +65 -10
  188. package/deps/jq/modules/oniguruma/test/test.sh +17 -0
  189. package/deps/jq/modules/oniguruma/test/test_back.c +1450 -0
  190. package/deps/jq/modules/oniguruma/test/test_options.c +228 -0
  191. package/deps/jq/modules/oniguruma/test/test_regset.c +466 -0
  192. package/deps/jq/modules/oniguruma/test/test_syntax.c +365 -0
  193. package/deps/jq/modules/oniguruma/test/test_utf8.c +1761 -0
  194. package/deps/jq/modules/oniguruma/test/testc.c +128 -88
  195. package/deps/jq/modules/oniguruma/test/testp.c +613 -0
  196. package/deps/jq/modules/oniguruma/test/testu.c +75 -28
  197. package/deps/jq/modules/oniguruma/tis-ci/stub.c +3 -0
  198. package/deps/jq/modules/oniguruma/tis-ci/test_back.config +26 -0
  199. package/deps/jq/modules/oniguruma/tis-ci/test_regset.config +20 -0
  200. package/deps/jq/modules/oniguruma/tis-ci/test_syntax.config +26 -0
  201. package/deps/jq/modules/oniguruma/tis-ci/test_utf8.config +25 -0
  202. package/deps/jq/modules/oniguruma/tis-ci/testc.config +26 -0
  203. package/deps/jq/modules/oniguruma/tis-ci/testu.config +24 -0
  204. package/deps/jq/modules/oniguruma/tis.config +1336 -0
  205. package/deps/jq/modules/oniguruma/windows/CMakeLists.txt +8 -0
  206. package/deps/jq/modules/oniguruma/windows/testc.c +865 -869
  207. package/deps/jq/scripts/update-website +6 -5
  208. package/deps/jq/scripts/version +10 -7
  209. package/deps/jq/sig/jq-release-new.key +29 -0
  210. package/deps/jq/sig/v1.4/sha256sum.txt +1 -0
  211. package/deps/jq/sig/v1.5/sha256sum.txt +2 -0
  212. package/deps/jq/sig/v1.5rc1/sha256sum.txt +1 -0
  213. package/deps/jq/sig/v1.5rc2/sha256sum.txt +2 -0
  214. package/deps/jq/sig/v1.6/sha256sum.txt +2 -0
  215. package/deps/jq/sig/v1.7/jq-1.7.tar.gz.asc +16 -0
  216. package/deps/jq/sig/v1.7/jq-1.7.zip.asc +16 -0
  217. package/deps/jq/sig/v1.7/jq-linux-amd64.asc +16 -0
  218. package/deps/jq/sig/v1.7/jq-linux-arm64.asc +16 -0
  219. package/deps/jq/sig/v1.7/jq-linux-armel.asc +16 -0
  220. package/deps/jq/sig/v1.7/jq-linux-armhf.asc +16 -0
  221. package/deps/jq/sig/v1.7/jq-linux-i386.asc +16 -0
  222. package/deps/jq/sig/v1.7/jq-linux-mips.asc +16 -0
  223. package/deps/jq/sig/v1.7/jq-linux-mips64.asc +16 -0
  224. package/deps/jq/sig/v1.7/jq-linux-mips64el.asc +16 -0
  225. package/deps/jq/sig/v1.7/jq-linux-mips64r6.asc +16 -0
  226. package/deps/jq/sig/v1.7/jq-linux-mips64r6el.asc +16 -0
  227. package/deps/jq/sig/v1.7/jq-linux-mipsel.asc +16 -0
  228. package/deps/jq/sig/v1.7/jq-linux-mipsr6.asc +16 -0
  229. package/deps/jq/sig/v1.7/jq-linux-mipsr6el.asc +16 -0
  230. package/deps/jq/sig/v1.7/jq-linux-powerpc.asc +16 -0
  231. package/deps/jq/sig/v1.7/jq-linux-ppc64el.asc +16 -0
  232. package/deps/jq/sig/v1.7/jq-linux-riscv64.asc +16 -0
  233. package/deps/jq/sig/v1.7/jq-linux-s390x.asc +16 -0
  234. package/deps/jq/sig/v1.7/jq-macos-amd64.asc +16 -0
  235. package/deps/jq/sig/v1.7/jq-macos-arm64.asc +16 -0
  236. package/deps/jq/sig/v1.7/jq-windows-amd64.exe.asc +16 -0
  237. package/deps/jq/sig/v1.7/jq-windows-i386.exe.asc +16 -0
  238. package/deps/jq/sig/v1.7/sha256sum.txt +23 -0
  239. package/deps/jq/sig/v1.7.1/jq-1.7.1.tar.gz.asc +16 -0
  240. package/deps/jq/sig/v1.7.1/jq-1.7.1.zip.asc +16 -0
  241. package/deps/jq/sig/v1.7.1/jq-linux-amd64.asc +16 -0
  242. package/deps/jq/sig/v1.7.1/jq-linux-arm64.asc +16 -0
  243. package/deps/jq/sig/v1.7.1/jq-linux-armel.asc +16 -0
  244. package/deps/jq/sig/v1.7.1/jq-linux-armhf.asc +16 -0
  245. package/deps/jq/sig/v1.7.1/jq-linux-i386.asc +16 -0
  246. package/deps/jq/sig/v1.7.1/jq-linux-mips.asc +16 -0
  247. package/deps/jq/sig/v1.7.1/jq-linux-mips64.asc +16 -0
  248. package/deps/jq/sig/v1.7.1/jq-linux-mips64el.asc +16 -0
  249. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6.asc +16 -0
  250. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6el.asc +16 -0
  251. package/deps/jq/sig/v1.7.1/jq-linux-mipsel.asc +16 -0
  252. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6.asc +16 -0
  253. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6el.asc +16 -0
  254. package/deps/jq/sig/v1.7.1/jq-linux-powerpc.asc +16 -0
  255. package/deps/jq/sig/v1.7.1/jq-linux-ppc64el.asc +16 -0
  256. package/deps/jq/sig/v1.7.1/jq-linux-riscv64.asc +16 -0
  257. package/deps/jq/sig/v1.7.1/jq-linux-s390x.asc +16 -0
  258. package/deps/jq/sig/v1.7.1/jq-linux64.asc +16 -0
  259. package/deps/jq/sig/v1.7.1/jq-macos-amd64.asc +16 -0
  260. package/deps/jq/sig/v1.7.1/jq-macos-arm64.asc +16 -0
  261. package/deps/jq/sig/v1.7.1/jq-osx-amd64.asc +16 -0
  262. package/deps/jq/sig/v1.7.1/jq-win64.exe.asc +16 -0
  263. package/deps/jq/sig/v1.7.1/jq-windows-amd64.exe.asc +16 -0
  264. package/deps/jq/sig/v1.7.1/jq-windows-i386.exe.asc +16 -0
  265. package/deps/jq/sig/v1.7.1/sha256sum.txt +26 -0
  266. package/deps/jq/sig/v1.7rc1/jq-1.7rc1.tar.gz.asc +16 -0
  267. package/deps/jq/sig/v1.7rc1/jq-1.7rc1.zip.asc +16 -0
  268. package/deps/jq/sig/v1.7rc1/jq-linux-amd64.asc +16 -0
  269. package/deps/jq/sig/v1.7rc1/jq-linux-arm64.asc +16 -0
  270. package/deps/jq/sig/v1.7rc1/jq-linux-armel.asc +16 -0
  271. package/deps/jq/sig/v1.7rc1/jq-linux-armhf.asc +16 -0
  272. package/deps/jq/sig/v1.7rc1/jq-linux-i386.asc +16 -0
  273. package/deps/jq/sig/v1.7rc1/jq-linux-mips.asc +16 -0
  274. package/deps/jq/sig/v1.7rc1/jq-linux-mips64.asc +16 -0
  275. package/deps/jq/sig/v1.7rc1/jq-linux-mips64el.asc +16 -0
  276. package/deps/jq/sig/v1.7rc1/jq-linux-mips64r6.asc +16 -0
  277. package/deps/jq/sig/v1.7rc1/jq-linux-mips64r6el.asc +16 -0
  278. package/deps/jq/sig/v1.7rc1/jq-linux-mipsel.asc +16 -0
  279. package/deps/jq/sig/v1.7rc1/jq-linux-mipsr6.asc +16 -0
  280. package/deps/jq/sig/v1.7rc1/jq-linux-mipsr6el.asc +16 -0
  281. package/deps/jq/sig/v1.7rc1/jq-linux-powerpc.asc +16 -0
  282. package/deps/jq/sig/v1.7rc1/jq-linux-ppc64el.asc +16 -0
  283. package/deps/jq/sig/v1.7rc1/jq-linux-riscv64.asc +16 -0
  284. package/deps/jq/sig/v1.7rc1/jq-linux-s390x.asc +16 -0
  285. package/deps/jq/sig/v1.7rc1/jq-macos-amd64.asc +16 -0
  286. package/deps/jq/sig/v1.7rc1/jq-macos-arm64.asc +16 -0
  287. package/deps/jq/sig/v1.7rc1/jq-windows-amd64.exe.asc +16 -0
  288. package/deps/jq/sig/v1.7rc1/jq-windows-i386.exe.asc +16 -0
  289. package/deps/jq/sig/v1.7rc1/sha256sum.txt +23 -0
  290. package/deps/jq/sig/v1.7rc2/jq-1.7rc2.tar.gz.asc +16 -0
  291. package/deps/jq/sig/v1.7rc2/jq-1.7rc2.zip.asc +16 -0
  292. package/deps/jq/sig/v1.7rc2/jq-linux-amd64.asc +16 -0
  293. package/deps/jq/sig/v1.7rc2/jq-linux-arm64.asc +16 -0
  294. package/deps/jq/sig/v1.7rc2/jq-linux-armel.asc +16 -0
  295. package/deps/jq/sig/v1.7rc2/jq-linux-armhf.asc +16 -0
  296. package/deps/jq/sig/v1.7rc2/jq-linux-i386.asc +16 -0
  297. package/deps/jq/sig/v1.7rc2/jq-linux-mips.asc +16 -0
  298. package/deps/jq/sig/v1.7rc2/jq-linux-mips64.asc +16 -0
  299. package/deps/jq/sig/v1.7rc2/jq-linux-mips64el.asc +16 -0
  300. package/deps/jq/sig/v1.7rc2/jq-linux-mips64r6.asc +16 -0
  301. package/deps/jq/sig/v1.7rc2/jq-linux-mips64r6el.asc +16 -0
  302. package/deps/jq/sig/v1.7rc2/jq-linux-mipsel.asc +16 -0
  303. package/deps/jq/sig/v1.7rc2/jq-linux-mipsr6.asc +16 -0
  304. package/deps/jq/sig/v1.7rc2/jq-linux-mipsr6el.asc +16 -0
  305. package/deps/jq/sig/v1.7rc2/jq-linux-powerpc.asc +16 -0
  306. package/deps/jq/sig/v1.7rc2/jq-linux-ppc64el.asc +16 -0
  307. package/deps/jq/sig/v1.7rc2/jq-linux-riscv64.asc +16 -0
  308. package/deps/jq/sig/v1.7rc2/jq-linux-s390x.asc +16 -0
  309. package/deps/jq/sig/v1.7rc2/jq-macos-amd64.asc +16 -0
  310. package/deps/jq/sig/v1.7rc2/jq-macos-arm64.asc +16 -0
  311. package/deps/jq/sig/v1.7rc2/jq-windows-amd64.exe.asc +16 -0
  312. package/deps/jq/sig/v1.7rc2/jq-windows-i386.exe.asc +16 -0
  313. package/deps/jq/sig/v1.7rc2/sha256sum.txt +23 -0
  314. package/deps/jq/src/builtin.c +537 -343
  315. package/deps/jq/src/builtin.h +18 -0
  316. package/deps/jq/src/builtin.jq +116 -143
  317. package/deps/jq/src/bytecode.h +8 -4
  318. package/deps/jq/src/compile.c +157 -143
  319. package/deps/jq/src/compile.h +3 -4
  320. package/deps/jq/src/decNumber/ICU-license.html +45 -0
  321. package/deps/jq/src/decNumber/decBasic.c +3908 -0
  322. package/deps/jq/src/decNumber/decCommon.c +1835 -0
  323. package/deps/jq/src/decNumber/decContext.c +437 -0
  324. package/deps/jq/src/decNumber/decContext.h +254 -0
  325. package/deps/jq/src/decNumber/decDPD.h +1185 -0
  326. package/deps/jq/src/decNumber/decDouble.c +140 -0
  327. package/deps/jq/src/decNumber/decDouble.h +155 -0
  328. package/deps/jq/src/decNumber/decNumber.c +8143 -0
  329. package/deps/jq/src/decNumber/decNumber.h +182 -0
  330. package/deps/jq/src/decNumber/decNumberLocal.h +757 -0
  331. package/deps/jq/src/decNumber/decPacked.c +220 -0
  332. package/deps/jq/src/decNumber/decPacked.h +52 -0
  333. package/deps/jq/src/decNumber/decQuad.c +135 -0
  334. package/deps/jq/src/decNumber/decQuad.h +177 -0
  335. package/deps/jq/src/decNumber/decSingle.c +71 -0
  336. package/deps/jq/src/decNumber/decSingle.h +86 -0
  337. package/deps/jq/src/decNumber/decimal128.c +553 -0
  338. package/deps/jq/src/decNumber/decimal128.h +81 -0
  339. package/deps/jq/src/decNumber/decimal32.c +476 -0
  340. package/deps/jq/src/decNumber/decimal32.h +81 -0
  341. package/deps/jq/src/decNumber/decimal64.c +839 -0
  342. package/deps/jq/src/decNumber/decimal64.h +83 -0
  343. package/deps/jq/src/decNumber/decnumber.pdf +0 -0
  344. package/deps/jq/src/decNumber/example1.c +38 -0
  345. package/deps/jq/src/decNumber/example2.c +52 -0
  346. package/deps/jq/src/decNumber/example3.c +64 -0
  347. package/deps/jq/src/decNumber/example4.c +61 -0
  348. package/deps/jq/src/decNumber/example5.c +36 -0
  349. package/deps/jq/src/decNumber/example6.c +61 -0
  350. package/deps/jq/src/decNumber/example7.c +35 -0
  351. package/deps/jq/src/decNumber/example8.c +39 -0
  352. package/deps/jq/src/decNumber/readme.txt +81 -0
  353. package/deps/jq/src/exec_stack.h +5 -3
  354. package/deps/jq/src/execute.c +126 -44
  355. package/deps/jq/src/inject_errors.c +0 -2
  356. package/deps/jq/src/jq.h +10 -1
  357. package/deps/jq/src/jq_test.c +222 -11
  358. package/deps/jq/src/jv.c +807 -176
  359. package/deps/jq/src/jv.h +22 -1
  360. package/deps/jq/src/jv_alloc.c +33 -26
  361. package/deps/jq/src/jv_alloc.h +0 -11
  362. package/deps/jq/src/jv_aux.c +153 -67
  363. package/deps/jq/src/jv_dtoa.c +12 -2
  364. package/deps/jq/src/jv_dtoa_tsd.c +51 -0
  365. package/deps/jq/src/jv_dtoa_tsd.h +4 -0
  366. package/deps/jq/src/jv_parse.c +70 -15
  367. package/deps/jq/src/jv_print.c +56 -60
  368. package/deps/jq/src/jv_private.h +7 -0
  369. package/deps/jq/src/jv_thread.h +76 -0
  370. package/deps/jq/src/jv_unicode.c +18 -0
  371. package/deps/jq/src/jv_unicode.h +2 -0
  372. package/deps/jq/src/lexer.c +782 -543
  373. package/deps/jq/src/lexer.h +438 -64
  374. package/deps/jq/src/lexer.l +10 -3
  375. package/deps/jq/src/libm.h +16 -6
  376. package/deps/jq/src/linker.c +97 -40
  377. package/deps/jq/src/locfile.c +2 -1
  378. package/deps/jq/src/main.c +384 -336
  379. package/deps/jq/src/opcode_list.h +5 -2
  380. package/deps/jq/src/parser.c +2260 -1898
  381. package/deps/jq/src/parser.h +115 -98
  382. package/deps/jq/src/parser.y +124 -89
  383. package/deps/jq/src/util.c +854 -55
  384. package/deps/jq/src/util.h +6 -4
  385. package/deps/jq/tests/jq.test +762 -26
  386. package/deps/jq/tests/jq_fuzz_compile.c +27 -0
  387. package/deps/jq/tests/jq_fuzz_execute.cpp +42 -0
  388. package/deps/jq/tests/jq_fuzz_fixed.cpp +297 -0
  389. package/deps/jq/tests/jq_fuzz_load_file.c +28 -0
  390. package/deps/jq/tests/jq_fuzz_parse.c +21 -0
  391. package/deps/jq/tests/jq_fuzz_parse_extended.c +36 -0
  392. package/deps/jq/tests/jq_fuzz_parse_stream.c +21 -0
  393. package/deps/jq/tests/local.supp +14 -0
  394. package/deps/jq/tests/man.test +979 -0
  395. package/deps/jq/tests/manonig.test +76 -0
  396. package/deps/jq/tests/manonigtest +5 -0
  397. package/deps/jq/tests/mantest +1 -2
  398. package/deps/jq/tests/modules/home2/.jq/g.jq +1 -0
  399. package/deps/jq/tests/modules/shadow1.jq +2 -0
  400. package/deps/jq/tests/modules/shadow2.jq +1 -0
  401. package/deps/jq/tests/modules/test_bind_order0.jq +1 -0
  402. package/deps/jq/tests/modules/test_bind_order1.jq +1 -1
  403. package/deps/jq/tests/modules/test_bind_order2.jq +0 -1
  404. package/deps/jq/tests/no-main-program.jq +1 -0
  405. package/deps/jq/tests/onig.test +77 -2
  406. package/deps/jq/tests/setup +7 -2
  407. package/deps/jq/tests/shtest +478 -59
  408. package/deps/jq/tests/uri.test +38 -0
  409. package/deps/jq/tests/uritest +5 -0
  410. package/deps/jq/tests/yes-main-program.jq +2 -0
  411. package/lib/index.js +3 -0
  412. package/lib/jq.js +15 -1
  413. package/lib/templateAsync.js +137 -0
  414. package/package.json +4 -3
  415. package/src/binding.cc +623 -146
  416. package/src/binding.h +3 -4
  417. package/test/santiy-async.test.js +171 -0
  418. package/test/santiy.test.js +2 -2
  419. package/test/template-async.test.js +182 -0
  420. package/test/template.test.js +3 -3
  421. package/deps/jq/.travis.yml +0 -202
  422. package/deps/jq/NEWS +0 -89
  423. package/deps/jq/appveyor.yml +0 -53
  424. package/deps/jq/docs/Gemfile +0 -7
  425. package/deps/jq/docs/Gemfile.lock +0 -63
  426. package/deps/jq/docs/Rakefile +0 -24
  427. package/deps/jq/docs/Rakefile.manual +0 -49
  428. package/deps/jq/docs/Rakefile.website +0 -76
  429. package/deps/jq/docs/content/1.tutorial/default.yml +0 -327
  430. package/deps/jq/docs/content/2.download/default.yml +0 -193
  431. package/deps/jq/docs/content/index/index.yml +0 -73
  432. package/deps/jq/docs/public/css/base.scss +0 -181
  433. package/deps/jq/docs/public/jq.png +0 -0
  434. package/deps/jq/docs/site.yml +0 -9
  435. package/deps/jq/docs/templates/default.liquid +0 -34
  436. package/deps/jq/docs/templates/index.liquid +0 -73
  437. package/deps/jq/docs/templates/manual.liquid +0 -99
  438. package/deps/jq/docs/templates/shared/_footer.liquid +0 -10
  439. package/deps/jq/docs/templates/shared/_head.liquid +0 -17
  440. package/deps/jq/docs/templates/shared/_navbar.liquid +0 -27
  441. package/deps/jq/modules/oniguruma/README.ja +0 -195
  442. package/deps/jq/modules/oniguruma/cmake/dist.cmake +0 -321
  443. package/deps/jq/modules/oniguruma/contributed/libfuzzer-onig.cpp +0 -31
  444. package/deps/jq/modules/oniguruma/dist.info +0 -10
  445. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold1_key.c +0 -2250
  446. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold2_key.c +0 -203
  447. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold3_key.c +0 -113
  448. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold_data.c +0 -1225
  449. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data.c +0 -24742
  450. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data_posix.c +0 -4846
  451. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_unfold_key.c +0 -2571
  452. /package/deps/jq/sig/{jq-release.key → jq-release-old.key} +0 -0
  453. /package/deps/jq/tests/modules/{.jq → home1/.jq} +0 -0
@@ -61,17 +61,18 @@ null
61
61
  null
62
62
  "interpolation"
63
63
 
64
- @text,@json,([1,.] | (@csv, @tsv)),@html,@uri,@sh,@base64,(@base64 | @base64d)
65
- "<>&'\"\t"
66
- "<>&'\"\t"
67
- "\"<>&'\\\"\\t\""
68
- "1,\"<>&'\"\"\t\""
69
- "1\t<>&'\"\\t"
70
- "&lt;&gt;&amp;&apos;&quot;\t"
71
- "%3C%3E%26'%22%09"
72
- "'<>&'\\''\"\t'"
73
- "PD4mJyIJ"
74
- "<>&'\"\t"
64
+ @text,@json,([1,.]|@csv,@tsv),@html,(@uri|.,@urid),@sh,(@base64|.,@base64d)
65
+ "!()<>&'\"\t"
66
+ "!()<>&'\"\t"
67
+ "\"!()<>&'\\\"\\t\""
68
+ "1,\"!()<>&'\"\"\t\""
69
+ "1\t!()<>&'\"\\t"
70
+ "!()&lt;&gt;&amp;&apos;&quot;\t"
71
+ "%21%28%29%3C%3E%26%27%22%09"
72
+ "!()<>&'\"\t"
73
+ "'!()<>&'\\''\"\t'"
74
+ "ISgpPD4mJyIJ"
75
+ "!()<>&'\"\t"
75
76
 
76
77
  # regression test for #436
77
78
  @base64
@@ -86,6 +87,10 @@ null
86
87
  "\u03bc"
87
88
  "%CE%BC"
88
89
 
90
+ @urid
91
+ "%CE%BC"
92
+ "\u03bc"
93
+
89
94
  @html "<b>\(.)</b>"
90
95
  "<script>hax</script>"
91
96
  "<b>&lt;script&gt;hax&lt;/script&gt;</b>"
@@ -146,6 +151,13 @@ jq: error: Cannot use number (0) as object key at <top-level>, line 1:
146
151
  {"foo": {"bar": 20}}
147
152
  20
148
153
 
154
+ .e0, .E1, .E-1, .E+1
155
+ {"e0": 1, "E1": 2, "E": 3}
156
+ 1
157
+ 2
158
+ 2
159
+ 4
160
+
149
161
  [.[]|.foo?]
150
162
  [1,[2],{"foo":3,"bar":4},{},{"foo":5}]
151
163
  [3,null,5]
@@ -166,6 +178,16 @@ jq: error: Cannot use number (0) as object key at <top-level>, line 1:
166
178
  [1,null,true,false,"abcdef",{},{"a":1,"b":2},[],[1,2,3,4,5],[1,2]]
167
179
  [null,"bc",[],[2,3],[2]]
168
180
 
181
+ # chaining/suffix-list, with and without dot
182
+ map(try .a[] catch ., try .a.[] catch ., .a[]?, .a.[]?)
183
+ [{"a": [1,2]}, {"a": 123}]
184
+ [1,2,1,2,1,2,1,2,"Cannot iterate over number (123)","Cannot iterate over number (123)"]
185
+
186
+ # oss-fuzz #66070: objects[] leaks if a non-last element throws an error
187
+ try ["OK", (.[] | error)] catch ["KO", .]
188
+ {"a":["b"],"c":["d"]}
189
+ ["KO",["b"]]
190
+
169
191
  #
170
192
  # Negative array indices
171
193
  #
@@ -236,9 +258,9 @@ null
236
258
  2
237
259
  3
238
260
 
239
- .[-2]
261
+ [.[-4,-3,-2,-1,0,1,2,3]]
240
262
  [1,2,3]
241
- 2
263
+ [null,1,2,3,1,2,3,null]
242
264
 
243
265
  [range(0;10)]
244
266
  null
@@ -300,13 +322,57 @@ null
300
322
  [{"a":1}, {"b":2}, {"a":3, "b":4}]
301
323
  [-1, -1, -4]
302
324
 
325
+ [foreach range(5) as $x (0; .+$x | select($x!=2); [$x,.])]
326
+ null
327
+ [[0,0],[1,1],[3,4],[4,8]]
328
+
303
329
  [limit(3; .[])]
304
330
  [11,22,33,44,55,66,77,88,99]
305
331
  [11,22,33]
306
332
 
307
- [first(range(.)), last(range(.)), nth(0; range(.)), nth(5; range(.)), try nth(-1; range(.)) catch .]
333
+ [limit(0; error)]
334
+ "badness"
335
+ []
336
+
337
+ [limit(1; 1, error)]
338
+ "badness"
339
+ [1]
340
+
341
+ try limit(-1; error) catch .
342
+ null
343
+ "limit doesn't support negative count"
344
+
345
+ [skip(3; .[])]
346
+ [1,2,3,4,5,6,7,8,9]
347
+ [4,5,6,7,8,9]
348
+
349
+ [skip(0,2,3,4; .[])]
350
+ [1,2,3]
351
+ [1,2,3,3]
352
+
353
+ [skip(3; .[])]
354
+ []
355
+ []
356
+
357
+ try skip(-1; error) catch .
358
+ null
359
+ "skip doesn't support negative count"
360
+
361
+ nth(1; 0,1,error("foo"))
362
+ null
363
+ 1
364
+
365
+ [first(range(.)), last(range(.))]
366
+ 10
367
+ [0,9]
368
+
369
+ [first(range(.)), last(range(.))]
370
+ 0
371
+ []
372
+
373
+ [nth(0,5,9,10,15; range(.)), try nth(-1; range(.)) catch .]
308
374
  10
309
- [0,9,0,5,"nth doesn't support negative indices"]
375
+ [0,5,9,"nth doesn't support negative indices"]
310
376
 
311
377
  # Check that first(g) does not extract more than one value from g
312
378
  first(1,error("foo"))
@@ -314,7 +380,7 @@ null
314
380
  1
315
381
 
316
382
  #
317
- # Check that various builtins evalute all arguments where appropriate,
383
+ # Check that various builtins evaluate all arguments where appropriate,
318
384
  # doing cartesian products where appropriate.
319
385
  #
320
386
 
@@ -524,6 +590,34 @@ null
524
590
  null
525
591
  [2, 8, 10, 14]
526
592
 
593
+ 1e-19 + 1e-20 - 5e-21
594
+ null
595
+ 1.05e-19
596
+
597
+ 1 / 1e-17
598
+ null
599
+ 1e+17
600
+
601
+ 9E999999999, 9999999999E999999990, 1E-999999999, 0.000000001E-999999990
602
+ null
603
+ 9E+999999999
604
+ 9.999999999E+999999999
605
+ 1E-999999999
606
+ 1E-999999999
607
+
608
+ 5E500000000 > 5E-5000000000, 10000E500000000 > 10000E-5000000000
609
+ null
610
+ true
611
+ true
612
+
613
+ # #2825
614
+ (1e999999999, 10e999999999) > (1e-1147483646, 0.1e-1147483646)
615
+ null
616
+ true
617
+ true
618
+ true
619
+ true
620
+
527
621
  25 % 7
528
622
  null
529
623
  4
@@ -532,6 +626,14 @@ null
532
626
  null
533
627
  172
534
628
 
629
+ [(infinite, -infinite) % (1, -1, infinite)]
630
+ null
631
+ [0,0,0,0,0,-1]
632
+
633
+ [nan % 1, 1 % nan | isnan]
634
+ null
635
+ [true,true]
636
+
535
637
  1 + tonumber + ("10" | tonumber)
536
638
  4
537
639
  15
@@ -577,6 +679,19 @@ map_values(.+1)
577
679
  [0,1,2]
578
680
  [1,2,3]
579
681
 
682
+ [add(null), add(range(range(10))), add(empty), add(10,range(10))]
683
+ null
684
+ [null,120,null,55]
685
+
686
+ # Real-world use case for add(empty)
687
+ .sum = add(.arr[])
688
+ {"arr":[]}
689
+ {"arr":[],"sum":null}
690
+
691
+ add({(.[]):1}) | keys
692
+ ["a","a","b","a","d","b","d","a","d"]
693
+ ["a","b","d"]
694
+
580
695
  #
581
696
  # User-defined functions
582
697
  # Oh god.
@@ -596,6 +711,10 @@ def f(a;b;c;d;e;f): [a+1,b,c,d,e,f]; f(.[0];.[1];.[0];.[0];.[0];.[0])
596
711
  [1,2]
597
712
  [2,2,1,1,1,1]
598
713
 
714
+ def f: 1; def g: f, def f: 2; def g: 3; f, def f: g; f, g; def f: 4; [f, def f: g; def g: 5; f, g]+[f,g]
715
+ null
716
+ [4,1,2,3,3,5,4,1,2,3,3]
717
+
599
718
  # Test precedence of 'def' vs '|'
600
719
  def a: 0; . | a
601
720
  null
@@ -710,6 +829,10 @@ reduce . as $n (.; .)
710
829
  null
711
830
  null
712
831
 
832
+ reduce range(5) as $x (0; .+$x | select($x!=2))
833
+ null
834
+ 8
835
+
713
836
  # Destructuring
714
837
  . as {$a, b: [$c, {$d}]} | [$a, $c, $d]
715
838
  {"a":1, "b":[2,{"d":3}]}
@@ -843,6 +966,51 @@ false
843
966
  [1,2,3,4,true]
844
967
  true
845
968
 
969
+ # Check short-circuiting
970
+ any(true, error; .)
971
+ "badness"
972
+ true
973
+
974
+ all(false, error; .)
975
+ "badness"
976
+ false
977
+
978
+ any(not)
979
+ []
980
+ false
981
+
982
+ all(not)
983
+ []
984
+ true
985
+
986
+ any(not)
987
+ [false]
988
+ true
989
+
990
+ all(not)
991
+ [false]
992
+ true
993
+
994
+ [any,all]
995
+ []
996
+ [false,true]
997
+
998
+ [any,all]
999
+ [true]
1000
+ [true,true]
1001
+
1002
+ [any,all]
1003
+ [false]
1004
+ [false,false]
1005
+
1006
+ [any,all]
1007
+ [true,false]
1008
+ [true,false]
1009
+
1010
+ [any,all]
1011
+ [null,null,true]
1012
+ [true,false]
1013
+
846
1014
  #
847
1015
  # Paths
848
1016
  #
@@ -884,10 +1052,6 @@ path(.a[path(.b)[0]])
884
1052
  [1,[[],{"a":2}]]
885
1053
  [[0],[1],[1,0],[1,1],[1,1,"a"]]
886
1054
 
887
- [leaf_paths]
888
- [1,[[],{"a":2}]]
889
- [[0],[1,1,"a"]]
890
-
891
1055
  ["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p])
892
1056
  {"bar": 42, "foo": ["a", "b", "c", "d"]}
893
1057
  "b"
@@ -929,6 +1093,28 @@ del(.[1], .[-6], .[2], .[-3:9])
929
1093
  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
930
1094
  [0, 3, 5, 6, 9]
931
1095
 
1096
+ # negative index
1097
+ setpath([-1]; 1)
1098
+ [0]
1099
+ [1]
1100
+
1101
+ pick(.a.b.c)
1102
+ null
1103
+ {"a":{"b":{"c":null}}}
1104
+
1105
+ pick(first)
1106
+ [1,2]
1107
+ [1]
1108
+
1109
+ pick(first|first)
1110
+ [[10,20],30]
1111
+ [[10]]
1112
+
1113
+ # negative indices in path expressions (since last/1 is .[-1])
1114
+ try pick(last) catch .
1115
+ [1,2]
1116
+ "Out of bounds negative array index"
1117
+
932
1118
  #
933
1119
  # Assignment
934
1120
  #
@@ -980,6 +1166,19 @@ def inc(x): x |= .+1; inc(.[].a)
980
1166
  {"a":[{"b":5}]}
981
1167
  {"a":[{"c":3,"b":5}]}
982
1168
 
1169
+ # #2051, deletion using assigning empty against arrays
1170
+ (.[] | select(. >= 2)) |= empty
1171
+ [1,5,3,0,7]
1172
+ [1,0]
1173
+
1174
+ .[] |= select(. % 2 == 0)
1175
+ [0,1,2,3,4,5]
1176
+ [0,2,4]
1177
+
1178
+ .foo[1,4,2,3] |= empty
1179
+ {"foo":[0,1,2,3,4,5]}
1180
+ {"foo":[0,5]}
1181
+
983
1182
  .[2][3] = 1
984
1183
  [4]
985
1184
  [4, null, [null, null, null, 1]]
@@ -1036,6 +1235,26 @@ null
1036
1235
  null
1037
1236
  [5,6]
1038
1237
 
1238
+ [if true then 3 end]
1239
+ 7
1240
+ [3]
1241
+
1242
+ [if false then 3 end]
1243
+ 7
1244
+ [7]
1245
+
1246
+ [if false then 3 else . end]
1247
+ 7
1248
+ [7]
1249
+
1250
+ [if false then 3 elif false then 4 end]
1251
+ 7
1252
+ [7]
1253
+
1254
+ [if false then 3 elif false then 4 else . end]
1255
+ 7
1256
+ [7]
1257
+
1039
1258
  [.[] | [.foo[] // .bar]]
1040
1259
  [{"foo":[1,2], "bar": 42}, {"foo":[1], "bar": null}, {"foo":[null,false,3], "bar": 18}, {"foo":[], "bar":42}, {"foo": [null,false,null], "bar": 41}]
1041
1260
  [[1,2], [1], [3], [42], [41]]
@@ -1091,6 +1310,28 @@ null
1091
1310
  {}
1092
1311
  [true, true, false]
1093
1312
 
1313
+ # containment operator (embedded NULs!)
1314
+ [contains(""), contains("\u0000")]
1315
+ "\u0000"
1316
+ [true, true]
1317
+
1318
+ [contains(""), contains("a"), contains("ab"), contains("c"), contains("d")]
1319
+ "ab\u0000cd"
1320
+ [true, true, true, true, true]
1321
+
1322
+ [contains("cd"), contains("b\u0000"), contains("ab\u0000")]
1323
+ "ab\u0000cd"
1324
+ [true, true, true]
1325
+
1326
+ [contains("b\u0000c"), contains("b\u0000cd"), contains("b\u0000cd")]
1327
+ "ab\u0000cd"
1328
+ [true, true, true]
1329
+
1330
+ [contains("@"), contains("\u0000@"), contains("\u0000what")]
1331
+ "ab\u0000cd"
1332
+ [false, false, false]
1333
+
1334
+
1094
1335
  # Try/catch and general `?` operator
1095
1336
  [.[]|try if . == 0 then error("foo") elif . == 1 then .a elif . == 2 then empty else . end catch .]
1096
1337
  [0,1,2,3]
@@ -1104,6 +1345,12 @@ null
1104
1345
  [null,true,{"a":1}]
1105
1346
  []
1106
1347
 
1348
+ .[] | try error catch .
1349
+ [1,null,2]
1350
+ 1
1351
+ null
1352
+ 2
1353
+
1107
1354
  try error("\($__loc__)") catch .
1108
1355
  null
1109
1356
  "{\"file\":\"<top-level>\",\"line\":1}"
@@ -1137,6 +1384,30 @@ split("")
1137
1384
  "a,bc,def,ghij,klmno"
1138
1385
  [1,13,[1,4,8,13]]
1139
1386
 
1387
+ [ index("aba"), rindex("aba"), indices("aba") ]
1388
+ "xababababax"
1389
+ [1,7,[1,3,5,7]]
1390
+
1391
+ # trim
1392
+ # \u000b is vertical tab (\v not supported by json)
1393
+ map(trim), map(ltrim), map(rtrim)
1394
+ [" \n\t\r\f\u000b", ""," ", "a", " a ", "abc", " abc ", " abc", "abc "]
1395
+ ["", "", "", "a", "a", "abc", "abc", "abc", "abc"]
1396
+ ["", "", "", "a", "a ", "abc", "abc ", "abc", "abc "]
1397
+ ["", "", "", "a", " a", "abc", " abc", " abc", "abc"]
1398
+
1399
+ trim, ltrim, rtrim
1400
+ "\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000abc\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000"
1401
+ "abc"
1402
+ "abc\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000"
1403
+ "\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000abc"
1404
+
1405
+ try trim catch ., try ltrim catch ., try rtrim catch .
1406
+ 123
1407
+ "trim input must be a string"
1408
+ "trim input must be a string"
1409
+ "trim input must be a string"
1410
+
1140
1411
  indices(1)
1141
1412
  [0,1,1,2,3,4,1,5]
1142
1413
  [1,2,6]
@@ -1153,6 +1424,22 @@ indices(", ")
1153
1424
  "a,b, cd,e, fgh, ijkl"
1154
1425
  [3,9,14]
1155
1426
 
1427
+ index("!")
1428
+ "здравствуй мир!"
1429
+ 14
1430
+
1431
+ .[:rindex("x")]
1432
+ "正xyz"
1433
+ "正"
1434
+
1435
+ indices("o")
1436
+ "🇬🇧oo"
1437
+ [2,3]
1438
+
1439
+ indices("o")
1440
+ "ƒoo"
1441
+ [1,2]
1442
+
1156
1443
  [.[]|split(",")]
1157
1444
  ["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"]
1158
1445
  [["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]]
@@ -1165,6 +1452,14 @@ indices(", ")
1165
1452
  ["a", "ab", "abc"]
1166
1453
  ["aaa", "ababab", "abcabcabc"]
1167
1454
 
1455
+ [.[] * "abc"]
1456
+ [-1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 3.7, 10.0]
1457
+ [null,null,"","","abc","abc","abcabcabc","abcabcabcabcabcabcabcabcabcabc"]
1458
+
1459
+ [. * (nan,-nan)]
1460
+ "abc"
1461
+ [null,null]
1462
+
1168
1463
  [.[] / ","]
1169
1464
  ["a, bc, def, ghij, jklmn, a,b, c,d, e,f", "a,b,c,d, e,f,g,h"]
1170
1465
  [["a"," bc"," def"," ghij"," jklmn"," a","b"," c","d"," e","f"],["a","b","c","d"," e","f","g","h"]]
@@ -1253,6 +1548,10 @@ map(has(2))
1253
1548
  [[0,1], ["a","b","c"]]
1254
1549
  [false, true]
1255
1550
 
1551
+ has(nan)
1552
+ [0,1,2]
1553
+ false
1554
+
1256
1555
  keys
1257
1556
  [42,3,35]
1258
1557
  [0,1,2]
@@ -1335,12 +1634,18 @@ transpose
1335
1634
  [[1], [2,3]]
1336
1635
  [[1,2],[null,3]]
1337
1636
 
1637
+ transpose
1638
+ []
1639
+ []
1640
+
1338
1641
  ascii_upcase
1339
1642
  "useful but not for é"
1340
1643
  "USEFUL BUT NOT FOR é"
1341
1644
 
1342
- bsearch(4)
1645
+ bsearch(0,2,4)
1343
1646
  [1,2,3]
1647
+ -1
1648
+ 1
1344
1649
  -4
1345
1650
 
1346
1651
  # strptime tests are in optional.test
@@ -1353,10 +1658,40 @@ strftime("%A, %B %d, %Y")
1353
1658
  1435677542.822351
1354
1659
  "Tuesday, June 30, 2015"
1355
1660
 
1661
+ strftime("%Y-%m-%dT%H:%M:%SZ")
1662
+ [2024,2,15]
1663
+ "2024-03-15T00:00:00Z"
1664
+
1665
+ mktime
1666
+ [2024,8,21]
1667
+ 1726876800
1668
+
1356
1669
  gmtime
1357
1670
  1425599507
1358
1671
  [2015,2,5,23,51,47,4,63]
1359
1672
 
1673
+ # test invalid tm input
1674
+ try strftime("%Y-%m-%dT%H:%M:%SZ") catch .
1675
+ ["a",1,2,3,4,5,6,7]
1676
+ "strftime/1 requires parsed datetime inputs"
1677
+
1678
+ try strflocaltime("%Y-%m-%dT%H:%M:%SZ") catch .
1679
+ ["a",1,2,3,4,5,6,7]
1680
+ "strflocaltime/1 requires parsed datetime inputs"
1681
+
1682
+ try mktime catch .
1683
+ ["a",1,2,3,4,5,6,7]
1684
+ "mktime requires parsed datetime inputs"
1685
+
1686
+ # oss-fuzz #67403: non-string argument with number input fails assert
1687
+ try ["OK", strftime([])] catch ["KO", .]
1688
+ 0
1689
+ ["KO","strftime/1 requires a string format"]
1690
+
1691
+ try ["OK", strflocaltime({})] catch ["KO", .]
1692
+ 0
1693
+ ["KO","strflocaltime/1 requires a string format"]
1694
+
1360
1695
  # module system
1361
1696
  import "a" as foo; import "b" as bar; def fooa: foo::a; [fooa, bar::a, bar::b, foo::a]
1362
1697
  null
@@ -1370,10 +1705,35 @@ include "c"; [a, c]
1370
1705
  null
1371
1706
  [0,"acmehbah"]
1372
1707
 
1708
+ import "data" as $e; import "data" as $d; [$d[].this,$e[].that,$d::d[].this,$e::e[].that]|join(";")
1709
+ null
1710
+ "is a test;is too;is a test;is too"
1711
+
1712
+ # Regression test for #2000
1713
+ import "data" as $a; import "data" as $b; def f: {$a, $b}; f
1714
+ null
1715
+ {"a":[{"this":"is a test","that":"is too"}],"b":[{"this":"is a test","that":"is too"}]}
1716
+
1717
+ include "shadow1"; e
1718
+ null
1719
+ 2
1720
+
1721
+ include "shadow1"; include "shadow2"; e
1722
+ null
1723
+ 3
1724
+
1725
+ import "shadow1" as f; import "shadow2" as f; import "shadow1" as e; [e::e, f::e]
1726
+ null
1727
+ [2,3]
1728
+
1373
1729
  %%FAIL
1374
1730
  module (.+1); 0
1375
1731
  jq: error: Module metadata must be constant at <top-level>, line 1:
1376
1732
 
1733
+ %%FAIL
1734
+ module []; 0
1735
+ jq: error: Module metadata must be an object at <top-level>, line 1:
1736
+
1377
1737
  %%FAIL
1378
1738
  include "a" (.+1); 0
1379
1739
  jq: error: Module metadata must be constant at <top-level>, line 1:
@@ -1392,7 +1752,15 @@ jq: error: Import path must be constant at <top-level>, line 1:
1392
1752
 
1393
1753
  modulemeta
1394
1754
  "c"
1395
- {"whatever":null,"deps":[{"as":"foo","is_data":false,"relpath":"a"},{"search":"./","as":"d","is_data":false,"relpath":"d"},{"search":"./","as":"d2","is_data":false,"relpath":"d"},{"search":"./../lib/jq","as":"e","is_data":false,"relpath":"e"},{"search":"./../lib/jq","as":"f","is_data":false,"relpath":"f"},{"as":"d","is_data":true,"relpath":"data"}]}
1755
+ {"whatever":null,"deps":[{"as":"foo","is_data":false,"relpath":"a"},{"search":"./","as":"d","is_data":false,"relpath":"d"},{"search":"./","as":"d2","is_data":false,"relpath":"d"},{"search":"./../lib/jq","as":"e","is_data":false,"relpath":"e"},{"search":"./../lib/jq","as":"f","is_data":false,"relpath":"f"},{"as":"d","is_data":true,"relpath":"data"}],"defs":["a/0","c/0"]}
1756
+
1757
+ modulemeta | .deps | length
1758
+ "c"
1759
+ 6
1760
+
1761
+ modulemeta | .defs | length
1762
+ "c"
1763
+ 2
1396
1764
 
1397
1765
  %%FAIL IGNORE MSG
1398
1766
  import "syntaxerror" as e; .
@@ -1442,16 +1810,24 @@ try (1/.) catch .
1442
1810
  0
1443
1811
  "number (1) and number (0) cannot be divided because the divisor is zero"
1444
1812
 
1813
+ try (1/0) catch .
1814
+ 0
1815
+ "number (1) and number (0) cannot be divided because the divisor is zero"
1816
+
1817
+ try (0/0) catch .
1818
+ 0
1819
+ "number (0) and number (0) cannot be divided because the divisor is zero"
1820
+
1445
1821
  try (1%.) catch .
1446
1822
  0
1447
1823
  "number (1) and number (0) cannot be divided (remainder) because the divisor is zero"
1448
1824
 
1449
- %%FAIL
1450
- 1/0
1451
- jq: error: Division by zero? at <top-level>, line 1:
1825
+ try (1%0) catch .
1826
+ 0
1827
+ "number (1) and number (0) cannot be divided (remainder) because the divisor is zero"
1452
1828
 
1453
1829
  # Basic numbers tests: integers, powers of two
1454
- [range(-52;52;1)] as $powers | [$powers[]|pow(2;.)|log2] == $powers
1830
+ [range(-52;52;1)] as $powers | [$powers[]|pow(2;.)|log2|round] == $powers
1455
1831
  null
1456
1832
  true
1457
1833
 
@@ -1481,6 +1857,17 @@ true
1481
1857
  true
1482
1858
  true
1483
1859
 
1860
+ range(5;13)|IN(range(0;10;3))
1861
+ null
1862
+ false
1863
+ true
1864
+ false
1865
+ false
1866
+ true
1867
+ false
1868
+ false
1869
+ false
1870
+
1484
1871
  range(10;12)|IN(range(10))
1485
1872
  null
1486
1873
  false
@@ -1516,4 +1903,353 @@ isempty(1,error("foo"))
1516
1903
  null
1517
1904
  false
1518
1905
 
1906
+ # Regression test for #1815
1907
+ index("")
1908
+ ""
1909
+ null
1910
+
1911
+ # check that dead code removal occurs after builtin it generation
1912
+ builtins|length > 10
1913
+ null
1914
+ true
1915
+
1916
+ "-1"|IN(builtins[] / "/"|.[1])
1917
+ null
1918
+ false
1919
+
1920
+ all(builtins[] / "/"; .[1]|tonumber >= 0)
1921
+ null
1922
+ true
1923
+
1924
+ builtins|any(.[:1] == "_")
1925
+ null
1926
+ false
1927
+
1928
+ ## Test ability to use keywords (uncomment after eval is pushed)
1929
+ #(.[] as $kw | "\"{\($kw)} as $\($kw) | $\($kw) | {$\($kw)} | {\($kw):.\($kw)}\""|eval|empty),null
1930
+ #["as","def","module","import","include","if","then","else","elif","end","reduce","foreach","and","or","try","catch","label","break","__loc__"]
1931
+ #null
1932
+ #
1933
+ #(.[] as $kw | "\"def f($\($kw)): $\($kw); f(.)\""|eval|empty),null
1934
+ #["as","def","module","import","include","if","then","else","elif","end","reduce","foreach","and","or","try","catch","label","break","__loc__"]
1935
+ #null
1936
+
1937
+
1938
+ #
1939
+ # Tests to cover the new toliteral number functionality
1940
+ # For an example see #1652 and other linked issues
1941
+ #
1942
+
1943
+ # We are backward and sanity compatible
1944
+
1945
+ map(. == 1)
1946
+ [1, 1.0, 1.000, 100e-2, 1e+0, 0.0001e4]
1947
+ [true, true, true, true, true, true]
1948
+
1949
+ # When no arithmetic is involved jq should preserve the literal value
1950
+
1951
+ .[0] | tostring | . == if have_decnum then "13911860366432393" else "13911860366432392" end
1952
+ [13911860366432393]
1953
+ true
1954
+
1955
+ .x | tojson | . == if have_decnum then "13911860366432393" else "13911860366432392" end
1956
+ {"x":13911860366432393}
1957
+ true
1958
+
1959
+ (13911860366432393 == 13911860366432392) | . == if have_decnum then false else true end
1960
+ null
1961
+ true
1962
+
1963
+
1964
+ # Applying arithmetic to the value will truncate the result to double
1965
+
1966
+ . - 10
1967
+ 13911860366432393
1968
+ 13911860366432382
1969
+
1970
+ .[0] - 10
1971
+ [13911860366432393]
1972
+ 13911860366432382
1973
+
1974
+ .x - 10
1975
+ {"x":13911860366432393}
1976
+ 13911860366432382
1977
+
1978
+ . |= try . catch .
1979
+ 1
1980
+ 1
1981
+
1982
+ # decnum to double conversion
1983
+ .[] as $n | $n+0 | [., tostring, . == $n]
1984
+ [-9007199254740993, -9007199254740992, 9007199254740992, 9007199254740993, 13911860366432393]
1985
+ [-9007199254740992,"-9007199254740992",true]
1986
+ [-9007199254740992,"-9007199254740992",true]
1987
+ [9007199254740992,"9007199254740992",true]
1988
+ [9007199254740992,"9007199254740992",true]
1989
+ [13911860366432392,"13911860366432392",true]
1990
+
1991
+ # abs, fabs, length
1992
+ abs
1993
+ "abc"
1994
+ "abc"
1995
+
1996
+ map(abs)
1997
+ [-0, 0, -10, -1.1]
1998
+ [0,0,10,1.1]
1999
+
2000
+ map(fabs == length) | unique
2001
+ [-10, -1.1, -1e-1, 1000000000000000002]
2002
+ [true]
2003
+
2004
+ # The following is NOT prescriptive:
2005
+ map(abs)
2006
+ [0.1,1000000000000000002]
2007
+ [1e-1, 1000000000000000002]
2008
+
2009
+ # Using a keyword as variable/label name
2010
+
2011
+ 123 as $label | $label
2012
+ null
2013
+ 123
2014
+
2015
+ [ label $if | range(10) | ., (select(. == 5) | break $if) ]
2016
+ null
2017
+ [0,1,2,3,4,5]
2018
+
2019
+ reduce .[] as $then (4 as $else | $else; . as $elif | . + $then * $elif)
2020
+ [1,2,3]
2021
+ 96
2022
+
2023
+ 1 as $foreach | 2 as $and | 3 as $or | { $foreach, $and, $or, a }
2024
+ {"a":4,"b":5}
2025
+ {"foreach":1,"and":2,"or":3,"a":4}
2026
+
2027
+ [ foreach .[] as $try (1 as $catch | $catch - 1; . + $try; .) ]
2028
+ [10,9,8,7]
2029
+ [10,19,27,34]
2030
+
2031
+
2032
+ # Object construction
2033
+
2034
+ { a, $__loc__, c }
2035
+ {"a":[1,2,3],"b":"foo","c":{"hi":"hey"}}
2036
+ {"a":[1,2,3],"__loc__":{"file":"<top-level>","line":1},"c":{"hi":"hey"}}
2037
+
2038
+ 1 as $x | "2" as $y | "3" as $z | { $x, as, $y: 4, ($z): 5, if: 6, foo: 7 }
2039
+ {"as":8}
2040
+ {"x":1,"as":8,"2":4,"3":5,"if":6,"foo":7}
2041
+
2042
+
2043
+ # nan is parsed as a valid NaN value from JSON
2044
+
2045
+ fromjson | isnan
2046
+ "nan"
2047
+ true
2048
+
2049
+ tojson | fromjson
2050
+ {"a":nan}
2051
+ {"a":null}
1519
2052
 
2053
+ # also "nan with payload" #2985
2054
+ if have_decnum then fromjson else nan end | isnan
2055
+ "nan1234"
2056
+ true
2057
+
2058
+
2059
+ # calling input/0, or debug/0 in a test doesn't crash jq
2060
+
2061
+ try input catch .
2062
+ null
2063
+ "break"
2064
+
2065
+ debug
2066
+ 1
2067
+ 1
2068
+
2069
+ # try/catch catches more than it should #1859
2070
+ "foo" | try ((try . catch "caught too much") | error) catch "caught just right"
2071
+ null
2072
+ "caught just right"
2073
+
2074
+ .[]|(try (if .=="hi" then . else error end) catch empty) | "\(.) there!"
2075
+ ["hi","ho"]
2076
+ "hi there!"
2077
+
2078
+ try (["hi","ho"]|.[]|(try . catch (if .=="ho" then "BROKEN"|error else empty end)) | if .=="ho" then error else "\(.) there!" end) catch "caught outside \(.)"
2079
+ null
2080
+ "hi there!"
2081
+ "caught outside ho"
2082
+
2083
+ .[]|(try . catch (if .=="ho" then "BROKEN"|error else empty end)) | if .=="ho" then error else "\(.) there!" end
2084
+ ["hi","ho"]
2085
+ "hi there!"
2086
+
2087
+ try (try error catch "inner catch \(.)") catch "outer catch \(.)"
2088
+ "foo"
2089
+ "inner catch foo"
2090
+
2091
+ try ((try error catch "inner catch \(.)")|error) catch "outer catch \(.)"
2092
+ "foo"
2093
+ "outer catch inner catch foo"
2094
+
2095
+ # Also #1859, but from #1885
2096
+ first(.?,.?)
2097
+ null
2098
+ null
2099
+
2100
+ # Also #1859, but from #2140
2101
+ {foo: "bar"} | .foo |= .?
2102
+ null
2103
+ {"foo": "bar"}
2104
+
2105
+ # Also #1859, but from #2220
2106
+ . |= try 2
2107
+ 1
2108
+ 2
2109
+
2110
+ . |= try 2 catch 3
2111
+ 1
2112
+ 2
2113
+
2114
+ .[] |= try tonumber
2115
+ ["1", "2a", "3", " 4 ", "5.67", ".89", "-876", "+5.43", 21]
2116
+ [1, 3, 5.67, 0.89, -876, 5.43, 21]
2117
+
2118
+ # Also 1859, but from 2073
2119
+ any(keys[]|tostring?;true)
2120
+ {"a":"1","b":"2","c":"3"}
2121
+ true
2122
+
2123
+
2124
+ # explode/implode
2125
+ # test replacement character (65533) for outside codepoint range and 0xd800 (55296) - 0xdfff (57343) utf16 surrogate pair range
2126
+ # 1.1 and 1.9 to test round down of non-ints
2127
+ implode|explode
2128
+ [-1,0,1,2,3,1114111,1114112,55295,55296,57343,57344,1.1,1.9]
2129
+ [65533,0,1,2,3,1114111,65533,55295,65533,65533,57344,1,1]
2130
+
2131
+ map(try implode catch .)
2132
+ [123,["a"],[nan]]
2133
+ ["implode input must be an array","string (\"a\") can't be imploded, unicode codepoint needs to be numeric","number (null) can't be imploded, unicode codepoint needs to be numeric"]
2134
+
2135
+ # walk
2136
+ walk(.)
2137
+ {"x":0}
2138
+ {"x":0}
2139
+
2140
+ walk(1)
2141
+ {"x":0}
2142
+ 1
2143
+
2144
+ # The following is a regression test, not a requirement:
2145
+ [walk(.,1)]
2146
+ {"x":0}
2147
+ [{"x":0},1]
2148
+
2149
+ # Issue #2584
2150
+ walk(select(IN({}, []) | not))
2151
+ {"a":1,"b":[]}
2152
+ {"a":1}
2153
+
2154
+ # #2815
2155
+ [range(10)] | .[1.2:3.5]
2156
+ null
2157
+ [1,2,3]
2158
+
2159
+ [range(10)] | .[1.5:3.5]
2160
+ null
2161
+ [1,2,3]
2162
+
2163
+ [range(10)] | .[1.7:3.5]
2164
+ null
2165
+ [1,2,3]
2166
+
2167
+ [range(10)] | .[1.7:4294967295]
2168
+ null
2169
+ [1,2,3,4,5,6,7,8,9]
2170
+
2171
+ [range(10)] | .[1.7:-4294967296]
2172
+ null
2173
+ []
2174
+
2175
+ [[range(10)] | .[1.1,1.5,1.7]]
2176
+ null
2177
+ [1,1,1]
2178
+
2179
+ [range(5)] | .[1.1] = 5
2180
+ null
2181
+ [0,5,2,3,4]
2182
+
2183
+ [range(3)] | .[nan:1]
2184
+ null
2185
+ [0]
2186
+
2187
+ [range(3)] | .[1:nan]
2188
+ null
2189
+ [1,2]
2190
+
2191
+ [range(3)] | .[nan]
2192
+ null
2193
+ null
2194
+
2195
+ try ([range(3)] | .[nan] = 9) catch .
2196
+ null
2197
+ "Cannot set array element at NaN index"
2198
+
2199
+ try ("foobar" | .[1.5:3.5] = "xyz") catch .
2200
+ null
2201
+ "Cannot update string slices"
2202
+
2203
+ try ([range(10)] | .[1.5:3.5] = ["xyz"]) catch .
2204
+ null
2205
+ [0,"xyz",4,5,6,7,8,9]
2206
+
2207
+ try ("foobar" | .[1.5]) catch .
2208
+ null
2209
+ "Cannot index string with number"
2210
+
2211
+
2212
+ # setpath/2 does not leak the input after an invalid get #2970
2213
+
2214
+ try ["ok", setpath([1]; 1)] catch ["ko", .]
2215
+ {"hi":"hello"}
2216
+ ["ko","Cannot index object with number"]
2217
+
2218
+ try fromjson catch .
2219
+ "{'a': 123}"
2220
+ "Invalid string literal; expected \", but got ' at line 1, column 5 (while parsing '{'a': 123}')"
2221
+
2222
+ # ltrimstr/1 rtrimstr/1 don't leak on invalid input #2977
2223
+
2224
+ try ltrimstr(1) catch "x", try rtrimstr(1) catch "x" | "ok"
2225
+ "hi"
2226
+ "ok"
2227
+ "ok"
2228
+
2229
+ try ltrimstr("x") catch "x", try rtrimstr("x") catch "x" | "ok"
2230
+ {"hey":[]}
2231
+ "ok"
2232
+ "ok"
2233
+
2234
+ # ltrimstr/1 and rtrimstr/1 return an error for non-strings. #2969
2235
+
2236
+ .[] as [$x, $y] | try ["ok", ($x | ltrimstr($y))] catch ["ko", .]
2237
+ [["hi",1],[1,"hi"],["hi","hi"],[1,1]]
2238
+ ["ko","startswith() requires string inputs"]
2239
+ ["ko","startswith() requires string inputs"]
2240
+ ["ok",""]
2241
+ ["ko","startswith() requires string inputs"]
2242
+
2243
+ .[] as [$x, $y] | try ["ok", ($x | rtrimstr($y))] catch ["ko", .]
2244
+ [["hi",1],[1,"hi"],["hi","hi"],[1,1]]
2245
+ ["ko","endswith() requires string inputs"]
2246
+ ["ko","endswith() requires string inputs"]
2247
+ ["ok",""]
2248
+ ["ko","endswith() requires string inputs"]
2249
+
2250
+
2251
+ # oss-fuzz #66061: setpath/2 leaks when indexing array with array
2252
+
2253
+ try ["OK", setpath([[1]]; 1)] catch ["KO", .]
2254
+ []
2255
+ ["KO","Cannot update field at array index of array"]