indices.json 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. [{
  2. "given":
  3. {"foo": {"bar": ["zero", "one", "two"]}},
  4. "cases": [
  5. {
  6. "expression": "foo.bar[0]",
  7. "result": "zero"
  8. },
  9. {
  10. "expression": "foo.bar[1]",
  11. "result": "one"
  12. },
  13. {
  14. "expression": "foo.bar[2]",
  15. "result": "two"
  16. },
  17. {
  18. "expression": "foo.bar[3]",
  19. "result": null
  20. },
  21. {
  22. "expression": "foo.bar[-1]",
  23. "result": "two"
  24. },
  25. {
  26. "expression": "foo.bar[-2]",
  27. "result": "one"
  28. },
  29. {
  30. "expression": "foo.bar[-3]",
  31. "result": "zero"
  32. },
  33. {
  34. "expression": "foo.bar[-4]",
  35. "result": null
  36. }
  37. ]
  38. },
  39. {
  40. "given":
  41. {"foo": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]},
  42. "cases": [
  43. {
  44. "expression": "foo.bar",
  45. "result": null
  46. },
  47. {
  48. "expression": "foo[0].bar",
  49. "result": "one"
  50. },
  51. {
  52. "expression": "foo[1].bar",
  53. "result": "two"
  54. },
  55. {
  56. "expression": "foo[2].bar",
  57. "result": "three"
  58. },
  59. {
  60. "expression": "foo[3].notbar",
  61. "result": "four"
  62. },
  63. {
  64. "expression": "foo[3].bar",
  65. "result": null
  66. },
  67. {
  68. "expression": "foo[0]",
  69. "result": {"bar": "one"}
  70. },
  71. {
  72. "expression": "foo[1]",
  73. "result": {"bar": "two"}
  74. },
  75. {
  76. "expression": "foo[2]",
  77. "result": {"bar": "three"}
  78. },
  79. {
  80. "expression": "foo[3]",
  81. "result": {"notbar": "four"}
  82. },
  83. {
  84. "expression": "foo[4]",
  85. "result": null
  86. }
  87. ]
  88. },
  89. {
  90. "given": [
  91. "one", "two", "three"
  92. ],
  93. "cases": [
  94. {
  95. "expression": "[0]",
  96. "result": "one"
  97. },
  98. {
  99. "expression": "[1]",
  100. "result": "two"
  101. },
  102. {
  103. "expression": "[2]",
  104. "result": "three"
  105. },
  106. {
  107. "expression": "[-1]",
  108. "result": "three"
  109. },
  110. {
  111. "expression": "[-2]",
  112. "result": "two"
  113. },
  114. {
  115. "expression": "[-3]",
  116. "result": "one"
  117. }
  118. ]
  119. },
  120. {
  121. "given": {"reservations": [
  122. {"instances": [{"foo": 1}, {"foo": 2}]}
  123. ]},
  124. "cases": [
  125. {
  126. "expression": "reservations[].instances[].foo",
  127. "result": [1, 2]
  128. },
  129. {
  130. "expression": "reservations[].instances[].bar",
  131. "result": []
  132. },
  133. {
  134. "expression": "reservations[].notinstances[].foo",
  135. "result": []
  136. },
  137. {
  138. "expression": "reservations[].notinstances[].foo",
  139. "result": []
  140. }
  141. ]
  142. },
  143. {
  144. "given": {"reservations": [{
  145. "instances": [
  146. {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]},
  147. {"foo": [{"bar": 5}, {"bar": 6}, {"notbar": [7]}, {"bar": 8}]},
  148. {"foo": "bar"},
  149. {"notfoo": [{"bar": 20}, {"bar": 21}, {"notbar": [7]}, {"bar": 22}]},
  150. {"bar": [{"baz": [1]}, {"baz": [2]}, {"baz": [3]}, {"baz": [4]}]},
  151. {"baz": [{"baz": [1, 2]}, {"baz": []}, {"baz": []}, {"baz": [3, 4]}]},
  152. {"qux": [{"baz": []}, {"baz": [1, 2, 3]}, {"baz": [4]}, {"baz": []}]}
  153. ],
  154. "otherkey": {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]}
  155. }, {
  156. "instances": [
  157. {"a": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]},
  158. {"b": [{"bar": 5}, {"bar": 6}, {"notbar": [7]}, {"bar": 8}]},
  159. {"c": "bar"},
  160. {"notfoo": [{"bar": 23}, {"bar": 24}, {"notbar": [7]}, {"bar": 25}]},
  161. {"qux": [{"baz": []}, {"baz": [1, 2, 3]}, {"baz": [4]}, {"baz": []}]}
  162. ],
  163. "otherkey": {"foo": [{"bar": 1}, {"bar": 2}, {"notbar": 3}, {"bar": 4}]}
  164. }
  165. ]},
  166. "cases": [
  167. {
  168. "expression": "reservations[].instances[].foo[].bar",
  169. "result": [1, 2, 4, 5, 6, 8]
  170. },
  171. {
  172. "expression": "reservations[].instances[].foo[].baz",
  173. "result": []
  174. },
  175. {
  176. "expression": "reservations[].instances[].notfoo[].bar",
  177. "result": [20, 21, 22, 23, 24, 25]
  178. },
  179. {
  180. "expression": "reservations[].instances[].notfoo[].notbar",
  181. "result": [[7], [7]]
  182. },
  183. {
  184. "expression": "reservations[].notinstances[].foo",
  185. "result": []
  186. },
  187. {
  188. "expression": "reservations[].instances[].foo[].notbar",
  189. "result": [3, [7]]
  190. },
  191. {
  192. "expression": "reservations[].instances[].bar[].baz",
  193. "result": [[1], [2], [3], [4]]
  194. },
  195. {
  196. "expression": "reservations[].instances[].baz[].baz",
  197. "result": [[1, 2], [], [], [3, 4]]
  198. },
  199. {
  200. "expression": "reservations[].instances[].qux[].baz",
  201. "result": [[], [1, 2, 3], [4], [], [], [1, 2, 3], [4], []]
  202. },
  203. {
  204. "expression": "reservations[].instances[].qux[].baz[]",
  205. "result": [1, 2, 3, 4, 1, 2, 3, 4]
  206. }
  207. ]
  208. },
  209. {
  210. "given": {
  211. "foo": [
  212. [["one", "two"], ["three", "four"]],
  213. [["five", "six"], ["seven", "eight"]],
  214. [["nine"], ["ten"]]
  215. ]
  216. },
  217. "cases": [
  218. {
  219. "expression": "foo[]",
  220. "result": [["one", "two"], ["three", "four"], ["five", "six"],
  221. ["seven", "eight"], ["nine"], ["ten"]]
  222. },
  223. {
  224. "expression": "foo[][0]",
  225. "result": ["one", "three", "five", "seven", "nine", "ten"]
  226. },
  227. {
  228. "expression": "foo[][1]",
  229. "result": ["two", "four", "six", "eight"]
  230. },
  231. {
  232. "expression": "foo[][0][0]",
  233. "result": []
  234. },
  235. {
  236. "expression": "foo[][2][2]",
  237. "result": []
  238. },
  239. {
  240. "expression": "foo[][0][0][100]",
  241. "result": []
  242. }
  243. ]
  244. },
  245. {
  246. "given": {
  247. "foo": [{
  248. "bar": [
  249. {
  250. "qux": 2,
  251. "baz": 1
  252. },
  253. {
  254. "qux": 4,
  255. "baz": 3
  256. }
  257. ]
  258. },
  259. {
  260. "bar": [
  261. {
  262. "qux": 6,
  263. "baz": 5
  264. },
  265. {
  266. "qux": 8,
  267. "baz": 7
  268. }
  269. ]
  270. }
  271. ]
  272. },
  273. "cases": [
  274. {
  275. "expression": "foo",
  276. "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]},
  277. {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}]
  278. },
  279. {
  280. "expression": "foo[]",
  281. "result": [{"bar": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}]},
  282. {"bar": [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]}]
  283. },
  284. {
  285. "expression": "foo[].bar",
  286. "result": [[{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3}],
  287. [{"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]]
  288. },
  289. {
  290. "expression": "foo[].bar[]",
  291. "result": [{"qux": 2, "baz": 1}, {"qux": 4, "baz": 3},
  292. {"qux": 6, "baz": 5}, {"qux": 8, "baz": 7}]
  293. },
  294. {
  295. "expression": "foo[].bar[].baz",
  296. "result": [1, 3, 5, 7]
  297. }
  298. ]
  299. },
  300. {
  301. "given": {
  302. "string": "string",
  303. "hash": {"foo": "bar", "bar": "baz"},
  304. "number": 23,
  305. "nullvalue": null
  306. },
  307. "cases": [
  308. {
  309. "expression": "string[]",
  310. "result": null
  311. },
  312. {
  313. "expression": "hash[]",
  314. "result": null
  315. },
  316. {
  317. "expression": "number[]",
  318. "result": null
  319. },
  320. {
  321. "expression": "nullvalue[]",
  322. "result": null
  323. },
  324. {
  325. "expression": "string[].foo",
  326. "result": null
  327. },
  328. {
  329. "expression": "hash[].foo",
  330. "result": null
  331. },
  332. {
  333. "expression": "number[].foo",
  334. "result": null
  335. },
  336. {
  337. "expression": "nullvalue[].foo",
  338. "result": null
  339. },
  340. {
  341. "expression": "nullvalue[].foo[].bar",
  342. "result": null
  343. }
  344. ]
  345. }
  346. ]