Skip to content

Commit

Permalink
Move test.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-simons committed Dec 18, 2024
1 parent 8c4b965 commit 76fce44
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -728,4 +728,46 @@ static boolean areSemanticallyEquivalent(Statement statement1, Map<String, Objec

return true;
}

@Test // GH-1147
void shouldNotRecognizeLocallyScopedElementsFromExistentialSubqueries() {
var cypher = """
MATCH (this:Series)
WHERE ((EXISTS {
MATCH (this)-[edge:MANUFACTURER]->(this0:Manufacturer)
WHERE (this0.name = $param0 AND edge.current = $param1)
}
OR EXISTS {
MATCH (this)-[edge:MANUFACTURER]->(this1:Manufacturer)
WHERE (this1.name = $param2 AND edge.current = $param3)
})
AND EXISTS {
MATCH (this)-[edge:BRAND]->(this2:Brand)
WHERE (this2.name = $param4 AND edge.current = $param5)
})
RETURN this""";
var renderer = Renderer.getRenderer(Configuration.newConfig()
.withPrettyPrint(true)
.withGeneratedNames(true)
.build());
var normalized = renderer.render(CypherParser.parse(cypher));
assertThat(normalized).isEqualTo("""
MATCH (v0:Series)
WHERE ((EXISTS {
MATCH (v0)-[v1:MANUFACTURER]->(v2:Manufacturer)
WHERE (v2.name = $p0
AND v1.current = $p1)
}
OR EXISTS {
MATCH (v0)-[v1:MANUFACTURER]->(v2:Manufacturer)
WHERE (v2.name = $p2
AND v1.current = $p3)
})
AND EXISTS {
MATCH (v0)-[v1:BRAND]->(v2:Brand)
WHERE (v2.name = $p4
AND v1.current = $p5)
})
RETURN v0""");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -608,48 +608,6 @@ void literalCallbacks() {
.containsExactly("NULL", "1.0", "100", "5039", "762", "'Hallo'", "true", "false", "Infinity", "NaN");
}

@Test // GH-1147
void shouldNotRecognizeLocallyScopedElementsFromExistentialSubqueries() {
var cypher = """
MATCH (this:Series)
WHERE ((EXISTS {
MATCH (this)-[edge:MANUFACTURER]->(this0:Manufacturer)
WHERE (this0.name = $param0 AND edge.current = $param1)
}
OR EXISTS {
MATCH (this)-[edge:MANUFACTURER]->(this1:Manufacturer)
WHERE (this1.name = $param2 AND edge.current = $param3)
})
AND EXISTS {
MATCH (this)-[edge:BRAND]->(this2:Brand)
WHERE (this2.name = $param4 AND edge.current = $param5)
})
RETURN this""";
var renderer = Renderer.getRenderer(Configuration.newConfig()
.withPrettyPrint(true)
.withGeneratedNames(true)
.build());
var normalized = renderer.render(CypherParser.parse(cypher));
assertThat(normalized).isEqualTo("""
MATCH (v0:Series)
WHERE ((EXISTS {
MATCH (v0)-[v1:MANUFACTURER]->(v2:Manufacturer)
WHERE (v2.name = $p0
AND v1.current = $p1)
}
OR EXISTS {
MATCH (v0)-[v1:MANUFACTURER]->(v2:Manufacturer)
WHERE (v2.name = $p2
AND v1.current = $p3)
})
AND EXISTS {
MATCH (v0)-[v1:BRAND]->(v2:Brand)
WHERE (v2.name = $p4
AND v1.current = $p5)
})
RETURN v0""");
}

@Nested
class InvocationCallbacks {

Expand Down

0 comments on commit 76fce44

Please sign in to comment.