123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- [{
- "given": {
- "foo": {
- "bar": {
- "baz": "val"
- },
- "other": {
- "baz": "val"
- },
- "other2": {
- "baz": "val"
- },
- "other3": {
- "notbaz": ["a", "b", "c"]
- },
- "other4": {
- "notbaz": ["a", "b", "c"]
- },
- "other5": {
- "other": {
- "a": 1,
- "b": 1,
- "c": 1
- }
- }
- }
- },
- "cases": [
- {
- "expression": "foo.*.baz",
- "result": ["val", "val", "val"]
- },
- {
- "expression": "foo.bar.*",
- "result": ["val"]
- },
- {
- "expression": "foo.*.notbaz",
- "result": [["a", "b", "c"], ["a", "b", "c"]]
- },
- {
- "expression": "foo.*.notbaz[0]",
- "result": ["a", "a"]
- },
- {
- "expression": "foo.*.notbaz[-1]",
- "result": ["c", "c"]
- }
- ]
- }, {
- "given": {
- "foo": {
- "first-1": {
- "second-1": "val"
- },
- "first-2": {
- "second-1": "val"
- },
- "first-3": {
- "second-1": "val"
- }
- }
- },
- "cases": [
- {
- "expression": "foo.*",
- "result": [{"second-1": "val"}, {"second-1": "val"},
- {"second-1": "val"}]
- },
- {
- "expression": "foo.*.*",
- "result": [["val"], ["val"], ["val"]]
- },
- {
- "expression": "foo.*.*.*",
- "result": [[], [], []]
- },
- {
- "expression": "foo.*.*.*.*",
- "result": [[], [], []]
- }
- ]
- }, {
- "given": {
- "foo": {
- "bar": "one"
- },
- "other": {
- "bar": "one"
- },
- "nomatch": {
- "notbar": "three"
- }
- },
- "cases": [
- {
- "expression": "*.bar",
- "result": ["one", "one"]
- }
- ]
- }, {
- "given": {
- "top1": {
- "sub1": {"foo": "one"}
- },
- "top2": {
- "sub1": {"foo": "one"}
- }
- },
- "cases": [
- {
- "expression": "*",
- "result": [{"sub1": {"foo": "one"}},
- {"sub1": {"foo": "one"}}]
- },
- {
- "expression": "*.sub1",
- "result": [{"foo": "one"},
- {"foo": "one"}]
- },
- {
- "expression": "*.*",
- "result": [[{"foo": "one"}],
- [{"foo": "one"}]]
- },
- {
- "expression": "*.*.foo[]",
- "result": ["one", "one"]
- },
- {
- "expression": "*.sub1.foo",
- "result": ["one", "one"]
- }
- ]
- },
- {
- "given":
- {"foo": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]},
- "cases": [
- {
- "expression": "foo[*].bar",
- "result": ["one", "two", "three"]
- },
- {
- "expression": "foo[*].notbar",
- "result": ["four"]
- }
- ]
- },
- {
- "given":
- [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}],
- "cases": [
- {
- "expression": "[*]",
- "result": [{"bar": "one"}, {"bar": "two"}, {"bar": "three"}, {"notbar": "four"}]
- },
- {
- "expression": "[*].bar",
- "result": ["one", "two", "three"]
- },
- {
- "expression": "[*].notbar",
- "result": ["four"]
- }
- ]
- },
- {
- "given": {
- "foo": {
- "bar": [
- {"baz": ["one", "two", "three"]},
- {"baz": ["four", "five", "six"]},
- {"baz": ["seven", "eight", "nine"]}
- ]
- }
- },
- "cases": [
- {
- "expression": "foo.bar[*].baz",
- "result": [["one", "two", "three"], ["four", "five", "six"], ["seven", "eight", "nine"]]
- },
- {
- "expression": "foo.bar[*].baz[0]",
- "result": ["one", "four", "seven"]
- },
- {
- "expression": "foo.bar[*].baz[1]",
- "result": ["two", "five", "eight"]
- },
- {
- "expression": "foo.bar[*].baz[2]",
- "result": ["three", "six", "nine"]
- },
- {
- "expression": "foo.bar[*].baz[3]",
- "result": []
- }
- ]
- },
- {
- "given": {
- "foo": {
- "bar": [["one", "two"], ["three", "four"]]
- }
- },
- "cases": [
- {
- "expression": "foo.bar[*]",
- "result": [["one", "two"], ["three", "four"]]
- },
- {
- "expression": "foo.bar[0]",
- "result": ["one", "two"]
- },
- {
- "expression": "foo.bar[0][0]",
- "result": "one"
- },
- {
- "expression": "foo.bar[0][0][0]",
- "result": null
- },
- {
- "expression": "foo.bar[0][0][0][0]",
- "result": null
- },
- {
- "expression": "foo[0][0]",
- "result": null
- }
- ]
- },
- {
- "given": {
- "foo": [
- {"bar": [{"kind": "basic"}, {"kind": "intermediate"}]},
- {"bar": [{"kind": "advanced"}, {"kind": "expert"}]},
- {"bar": "string"}
- ]
- },
- "cases": [
- {
- "expression": "foo[*].bar[*].kind",
- "result": [["basic", "intermediate"], ["advanced", "expert"]]
- },
- {
- "expression": "foo[*].bar[0].kind",
- "result": ["basic", "advanced"]
- }
- ]
- },
- {
- "given": {
- "foo": [
- {"bar": {"kind": "basic"}},
- {"bar": {"kind": "intermediate"}},
- {"bar": {"kind": "advanced"}},
- {"bar": {"kind": "expert"}},
- {"bar": "string"}
- ]
- },
- "cases": [
- {
- "expression": "foo[*].bar.kind",
- "result": ["basic", "intermediate", "advanced", "expert"]
- }
- ]
- },
- {
- "given": {
- "foo": [{"bar": ["one", "two"]}, {"bar": ["three", "four"]}, {"bar": ["five"]}]
- },
- "cases": [
- {
- "expression": "foo[*].bar[0]",
- "result": ["one", "three", "five"]
- },
- {
- "expression": "foo[*].bar[1]",
- "result": ["two", "four"]
- },
- {
- "expression": "foo[*].bar[2]",
- "result": []
- }
- ]
- },
- {
- "given": {
- "foo": [{"bar": []}, {"bar": []}, {"bar": []}]
- },
- "cases": [
- {
- "expression": "foo[*].bar[0]",
- "result": []
- }
- ]
- },
- {
- "given": {
- "foo": [["one", "two"], ["three", "four"], ["five"]]
- },
- "cases": [
- {
- "expression": "foo[*][0]",
- "result": ["one", "three", "five"]
- },
- {
- "expression": "foo[*][1]",
- "result": ["two", "four"]
- }
- ]
- },
- {
- "given": {
- "foo": [
- [
- ["one", "two"], ["three", "four"]
- ], [
- ["five", "six"], ["seven", "eight"]
- ], [
- ["nine"], ["ten"]
- ]
- ]
- },
- "cases": [
- {
- "expression": "foo[*][0]",
- "result": [["one", "two"], ["five", "six"], ["nine"]]
- },
- {
- "expression": "foo[*][1]",
- "result": [["three", "four"], ["seven", "eight"], ["ten"]]
- },
- {
- "expression": "foo[*][0][0]",
- "result": ["one", "five", "nine"]
- },
- {
- "expression": "foo[*][1][0]",
- "result": ["three", "seven", "ten"]
- },
- {
- "expression": "foo[*][0][1]",
- "result": ["two", "six"]
- },
- {
- "expression": "foo[*][1][1]",
- "result": ["four", "eight"]
- },
- {
- "expression": "foo[*][2]",
- "result": []
- },
- {
- "expression": "foo[*][2][2]",
- "result": []
- },
- {
- "expression": "bar[*]",
- "result": null
- },
- {
- "expression": "bar[*].baz[*]",
- "result": null
- }
- ]
- },
- {
- "given": {
- "string": "string",
- "hash": {"foo": "bar", "bar": "baz"},
- "number": 23,
- "nullvalue": null
- },
- "cases": [
- {
- "expression": "string[*]",
- "result": null
- },
- {
- "expression": "hash[*]",
- "result": null
- },
- {
- "expression": "number[*]",
- "result": null
- },
- {
- "expression": "nullvalue[*]",
- "result": null
- },
- {
- "expression": "string[*].foo",
- "result": null
- },
- {
- "expression": "hash[*].foo",
- "result": null
- },
- {
- "expression": "number[*].foo",
- "result": null
- },
- {
- "expression": "nullvalue[*].foo",
- "result": null
- },
- {
- "expression": "nullvalue[*].foo[*].bar",
- "result": null
- }
- ]
- },
- {
- "given": {
- "string": "string",
- "hash": {"foo": "val", "bar": "val"},
- "number": 23,
- "array": [1, 2, 3],
- "nullvalue": null
- },
- "cases": [
- {
- "expression": "string.*",
- "result": null
- },
- {
- "expression": "hash.*",
- "result": ["val", "val"]
- },
- {
- "expression": "number.*",
- "result": null
- },
- {
- "expression": "array.*",
- "result": null
- },
- {
- "expression": "nullvalue.*",
- "result": null
- }
- ]
- },
- {
- "given": {
- "a": [0, 1, 2],
- "b": [0, 1, 2]
- },
- "cases": [
- {
- "expression": "*[0]",
- "result": [0, 0]
- }
- ]
- }
- ]
|