Emit compile time error on creation of undirected edges by jeffreylovitz · Pull Request #1212 · RedisGraph/RedisGraph · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/ast/ast_validations.c
12 changes: 11 additions & 1 deletion tests/flow/test_query_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test18_undefined_variable_access(self):
assert("not defined" in e.message)
pass

def test_invalid_cypher_options(self):
def test19_invalid_cypher_options(self):
query = "EXPLAIN MATCH (p:president)-[:born]->(:state {name:'Hawaii'}) RETURN p"
try:
redis_graph.query(query)
Expand Down Expand Up @@ -259,3 +259,13 @@ def test_invalid_cypher_options(self):
# Expecting an error.
pass

# Undirected edges are not allowed in CREATE clauses.
def test20_undirected_edge_creation(self):
try:
query = """CREATE (:Endpoint)-[:R]-(:Endpoint)"""
redis_graph.query(query)
assert(False)
except redis.exceptions.ResponseError as e:
# Expecting an error.
assert("Only directed relationships" in e.message)
pass
1 change: 0 additions & 1 deletion tests/tck/features/CreateAcceptance.feature
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ Feature: CreateAcceptance
| +nodes | 2 |
| +relationships | 2 |

@skip
Scenario: Fail when trying to create using an undirected relationship pattern
Given any graph
When executing query:
Expand Down
2 changes: 0 additions & 2 deletions tests/tck/features/MiscellaneousErrorAcceptance.feature
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,13 @@ Feature: MiscellaneousErrorAcceptance
"""
Then a SyntaxError should be raised at compile time: InvalidClauseComposition

@skip
Scenario: Failing when creating without direction
When executing query:
"""
CREATE (a)-[:FOO]-(b)
"""
Then a SyntaxError should be raised at compile time: RequiresDirectedRelationship

@skip
Scenario: Failing when creating with two directions
When executing query:
"""
Expand Down
6 changes: 6 additions & 0 deletions tests/tck/features/steps/Steps.py