Skip to content

Commit

Permalink
add quote escape tests for filter expressions (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis authored May 16, 2024
1 parent fadbe5f commit 0ddbb76
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/filter.json
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,30 @@
"selector" : "$[?(@.a || @.b) && @.b]",
"document" : [{"a": 1}],
"result": []
},
{
"name": "string literal, single quote in double quotes",
"selector" : "$[?@ == \"quoted' literal\"]",
"document" : ["quoted' literal", "a", "quoted\\' literal"],
"result": ["quoted' literal"]
},
{
"name": "string literal, double quote in single quotes",
"selector" : "$[?@ == 'quoted\" literal']",
"document" : ["quoted\" literal", "a", "quoted\\\" literal", "'quoted\" literal'"],
"result": ["quoted\" literal"]
},
{
"name": "string literal, escaped single quote in single quotes",
"selector" : "$[?@ == 'quoted\\' literal']",
"document" : ["quoted' literal", "a", "quoted\\' literal", "'quoted\" literal'"],
"result": ["quoted' literal"]
},
{
"name": "string literal, escaped double quote in double quotes",
"selector" : "$[?@ == \"quoted\\\" literal\"]",
"document" : ["quoted\" literal", "a", "quoted\\\" literal", "'quoted\" literal'"],
"result": ["quoted\" literal"]
}
]
}

0 comments on commit 0ddbb76

Please sign in to comment.