-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7535 from boggle/3.1-simple-merge
Move legacy merge acceptance tests from openCypher back to the product
- Loading branch information
Showing
1 changed file
with
135 additions
and
0 deletions.
There are no files selected for viewing
135 changes: 135 additions & 0 deletions
135
...er/acceptance-spec-suite/src/test/resources/cypher/features/MergeLegacyAcceptance.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# | ||
# Copyright (c) 2002-2016 "Neo Technology," | ||
# Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
# | ||
# This file is part of Neo4j. | ||
# | ||
# Neo4j is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
Feature: MergeLegacyAcceptance | ||
|
||
Scenario: Using a single bound node | ||
Given an empty graph | ||
And having executed: | ||
""" | ||
CREATE (:A) | ||
""" | ||
When executing query: | ||
""" | ||
MATCH (a:A) | ||
MERGE (a)-[r:TYPE]->() | ||
RETURN count(r) | ||
""" | ||
Then the result should be: | ||
| count(r) | | ||
| 1 | | ||
And the side effects should be: | ||
| +nodes | 1 | | ||
| +relationships | 1 | | ||
|
||
Scenario: Using a longer pattern | ||
Given an empty graph | ||
And having executed: | ||
""" | ||
CREATE (:A) | ||
""" | ||
When executing query: | ||
""" | ||
MATCH (a:A) | ||
MERGE (a)-[r:TYPE]->()<-[:TYPE]-() | ||
RETURN count(r) | ||
""" | ||
Then the result should be: | ||
| count(r) | | ||
| 1 | | ||
And the side effects should be: | ||
| +nodes | 2 | | ||
| +relationships | 2 | | ||
|
||
Scenario: Using bound nodes in mid-pattern | ||
Given an empty graph | ||
And having executed: | ||
""" | ||
CREATE (:B) | ||
""" | ||
When executing query: | ||
""" | ||
MATCH (b:B) | ||
MERGE (a)-[r1:TYPE]->(b)<-[r2:TYPE]-(c) | ||
RETURN type(r1), type(r2) | ||
""" | ||
Then the result should be: | ||
| type(r1) | type(r2) | | ||
| 'TYPE' | 'TYPE' | | ||
And the side effects should be: | ||
| +nodes | 2 | | ||
| +relationships | 2 | | ||
|
||
Scenario: Using bound nodes in mid-pattern when pattern partly matches | ||
Given an empty graph | ||
And having executed: | ||
""" | ||
CREATE (a:A), (b:B) | ||
CREATE (a)-[:TYPE]->(b) | ||
""" | ||
When executing query: | ||
""" | ||
MATCH (b:B) | ||
MERGE (a:A)-[r1:TYPE]->(b)<-[r2:TYPE]-(c:C) | ||
RETURN type(r1), type(r2) | ||
""" | ||
Then the result should be: | ||
| type(r1) | type(r2) | | ||
| 'TYPE' | 'TYPE' | | ||
And the side effects should be: | ||
| +nodes | 2 | | ||
| +relationships | 2 | | ||
| +labels | 2 | | ||
|
||
Scenario: Introduce named paths | ||
Given an empty graph | ||
When executing query: | ||
""" | ||
MERGE (a:A) | ||
MERGE p = (a)-[:R]->() | ||
RETURN p | ||
""" | ||
Then the result should be: | ||
| p | | ||
| <(:A)-[:R]->()> | | ||
And the side effects should be: | ||
| +nodes | 2 | | ||
| +relationships | 1 | | ||
| +labels | 1 | | ||
|
||
Scenario: Unbound pattern | ||
Given an empty graph | ||
When executing query: | ||
""" | ||
MERGE ({name: 'Andres'})-[:R]->({name: 'Emil'}) | ||
""" | ||
Then the result should be empty | ||
And the side effects should be: | ||
| +nodes | 2 | | ||
| +relationships | 1 | | ||
| +properties | 2 | | ||
|
||
Scenario: Fail when imposing new predicates on a variable that is already bound | ||
Given any graph | ||
When executing query: | ||
""" | ||
MERGE (a:Foo)-[r:KNOWS]->(a:Bar) | ||
""" | ||
Then a SyntaxError should be raised at compile time: VariableAlreadyBound |