Skip to content

Commit

Permalink
Merge pull request #81 from jg-rp/literal-comparison
Browse files Browse the repository at this point in the history
Test that filter expression literals must be compared
  • Loading branch information
gregsdennis authored May 18, 2024
2 parents a4b176f + bca0cac commit 466da9d
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,66 @@
"selector" : "$[?@ == \"quoted\\\" literal\"]",
"document" : ["quoted\" literal", "a", "quoted\\\" literal", "'quoted\" literal'"],
"result": ["quoted\" literal"]
},
{
"name": "literal true must be compared",
"selector" : "$[?true]",
"invalid_selector": true
},
{
"name": "literal false must be compared",
"selector" : "$[?false]",
"invalid_selector": true
},
{
"name": "literal string must be compared",
"selector" : "$[?'abc']",
"invalid_selector": true
},
{
"name": "literal int must be compared",
"selector" : "$[?2]",
"invalid_selector": true
},
{
"name": "literal float must be compared",
"selector" : "$[?2.2]",
"invalid_selector": true
},
{
"name": "literal null must be compared",
"selector" : "$[?null]",
"invalid_selector": true
},
{
"name": "and, literals must be compared",
"selector" : "$[?true && false]",
"invalid_selector": true
},
{
"name": "or, literals must be compared",
"selector" : "$[?true || false]",
"invalid_selector": true
},
{
"name": "and, right hand literal must be compared",
"selector" : "$[?true == false && false]",
"invalid_selector": true
},
{
"name": "or, right hand literal must be compared",
"selector" : "$[?true == false || false]",
"invalid_selector": true
},
{
"name": "and, left hand literal must be compared",
"selector" : "$[?false && true == false]",
"invalid_selector": true
},
{
"name": "or, left hand literal must be compared",
"selector" : "$[?false || true == false]",
"invalid_selector": true
}
]
}

0 comments on commit 466da9d

Please sign in to comment.