Skip to content

Commit

Permalink
Test that && binds more tightly than ||
Browse files Browse the repository at this point in the history
  • Loading branch information
jg-rp committed Mar 6, 2024
1 parent c1c6b88 commit 728b7fa
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,44 @@
[1, 2],
[2, 1]
]
},
{
"name": "and binds more tightly than or",
"selector" : "$[[email protected] || @.b && @.b]",
"document" : [{"a": 1}],
"result": [
{"a": 1}
]
},
{
"name": "left to right evaluation",
"selector" : "$[[email protected] && @.b || @.a]",
"document" : [{"a": 1}],
"result": [
{"a": 1}
]
},
{
"name": "group terms, left",
"selector" : "$[?(@.a || @.b) && @.a]",
"document" : [{"a": 1}],
"result": [
{"a": 1}
]
},
{
"name": "group terms, right",
"selector" : "$[[email protected] && (@.b || @.a)]",
"document" : [{"a": 1}],
"result": [
{"a": 1}
]
},
{
"name": "group terms, or before and",
"selector" : "$[?(@.a || @.b) && @.b]",
"document" : [{"a": 1}],
"result": []
}
]
}

0 comments on commit 728b7fa

Please sign in to comment.