Skip to content

Commit

Permalink
add test that demonstrates the parsing error mentioned in #5210 (comm…
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Oct 20, 2023
1 parent 083e01e commit d6f3909
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,17 @@ class ElementFiltersParserTest {
notMatchesTags(mapOfKeys("a", "b", "c", "d"), expr)
}

@Test fun `brackets are not dissolved illegally`() {
val expr = "a or (b or c) and !(d)"
matchesTags(mapOfKeys("a"), expr)
matchesTags(mapOfKeys("a", "d"), expr)
matchesTags(mapOfKeys("b"), expr)
matchesTags(mapOfKeys("c"), expr)
notMatchesTags(mapOfKeys("c", "d"), expr)
notMatchesTags(mapOfKeys("b", "d"), expr)
matchesTags(mapOfKeys("a", "c", "d"), expr)
}

private fun shouldFail(input: String) {
assertFailsWith<ParseException> {
input.toElementFilterExpression()
Expand Down

0 comments on commit d6f3909

Please sign in to comment.