Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve boolean operator order of ops and grouping tests #83

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions tests/filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -897,42 +897,46 @@
},
{
"name": "and binds more tightly than or",
"selector" : "$[[email protected] || @.b && @.b]",
"document" : [{"a": 1}],
"selector" : "$[[email protected] || @.b && @.c]",
"document" : [{"a": 1}, {"b": 2, "c": 3}, {"c": 3}, {"b": 2}, {"a": 1, "b": 2, "c": 3}],
"result": [
{"a": 1}
{"a": 1},
{"b": 2, "c": 3},
{"a": 1, "b": 2, "c": 3}
]
},
{
"name": "left to right evaluation",
"selector" : "$[?@.b && @.b || @.a]",
"document" : [{"a": 1}],
"selector" : "$[?@.a && @.b || @.c]",
"document" : [{"a": 1}, {"b": 2}, {"a": 1, "b": 2}, {"a": 1, "c": 3}, {"b": 1, "c": 3}, {"c": 3}, {"a": 1, "b": 2, "c": 3}],
"result": [
{"a": 1}
{"a": 1, "b": 2},
{"a": 1, "c": 3},
{"b": 1, "c": 3},
{"c": 3},
{"a": 1, "b": 2, "c": 3}
]
},
{
"name": "group terms, left",
"selector" : "$[?(@.a || @.b) && @.a]",
"document" : [{"a": 1}],
"selector" : "$[?(@.a || @.b) && @.c]",
"document" : [{"a": 1, "b": 2}, {"a": 1, "c": 3}, {"b": 2, "c": 3}, {"a": 1}, {"b": 2}, {"c": 3}, {"a": 1, "b": 2, "c": 3}],
"result": [
{"a": 1}
{"a": 1, "c": 3},
{"b": 2, "c": 3},
{"a": 1, "b": 2, "c": 3}
]
},
{
"name": "group terms, right",
"selector" : "$[[email protected] && (@.b || @.a)]",
"document" : [{"a": 1}],
"selector" : "$[[email protected] && (@.b || @.c)]",
"document" : [{"a": 1}, {"a": 1, "b": 2}, {"a": 1, "c": 2}, {"b": 2}, {"c": 2}, {"a": 1, "b": 2, "c": 3}],
"result": [
{"a": 1}
{"a": 1, "b": 2},
{"a": 1, "c": 2},
{"a": 1, "b": 2, "c": 3}
]
},
{
"name": "group terms, or before and",
"selector" : "$[?(@.a || @.b) && @.b]",
"document" : [{"a": 1}],
"result": []
},
{
"name": "string literal, single quote in double quotes",
"selector" : "$[?@ == \"quoted' literal\"]",
Expand Down
Loading