Skip to content

Commit

Permalink
Merge pull request #372 from sherfert/skip-limit-scenarios
Browse files Browse the repository at this point in the history
Correct wrong assertions for SKIP/LIMIT.
  • Loading branch information
Mats-SX authored Jul 26, 2019
2 parents 98bd4e3 + 0932541 commit 18fc8ba
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 29 deletions.
29 changes: 0 additions & 29 deletions tck/features/OrderByAcceptance.feature
Original file line number Diff line number Diff line change
Expand Up @@ -365,32 +365,3 @@ Feature: OrderByAcceptance
Then the result should be, in order:
| name |
And no side effects

Scenario: ORDER BY with negative parameter for LIMIT should not generate errors
And parameters are:
| limit | -1 |
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
ORDER BY p.name
LIMIT $`limit`
"""
Then the result should be, in order:
| name |
And no side effects

Scenario: ORDER BY with a negative LIMIT should fail with a syntax exception
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
ORDER BY p.name
LIMIT -1
"""
Then a SyntaxError should be raised at compile time: NegativeIntegerArgument
152 changes: 152 additions & 0 deletions tck/features/SkipLimitAcceptance.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,155 @@ Feature: SkipLimitAcceptanceTest
| count |
| 2 |
And no side effects

Scenario: Negative parameter for LIMIT should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
And parameters are:
| limit | -1 |
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
LIMIT $limit
"""
Then a SyntaxError should be raised at runtime: NegativeIntegerArgument

Scenario: Negative parameter for LIMIT with ORDER BY should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
And parameters are:
| limit | -1 |
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
ORDER BY name LIMIT $limit
"""
Then a SyntaxError should be raised at runtime: NegativeIntegerArgument

Scenario: Negative LIMIT should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
LIMIT -1
"""
Then a SyntaxError should be raised at compile time: NegativeIntegerArgument

Scenario: Negative parameter for SKIP should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
And parameters are:
| skip | -1 |
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
SKIP $skip
"""
Then a SyntaxError should be raised at runtime: NegativeIntegerArgument

Scenario: Negative SKIP should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
SKIP -1
"""
Then a SyntaxError should be raised at compile time: NegativeIntegerArgument

Scenario: Floating point parameter for LIMIT should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
And parameters are:
| limit | 1.5 |
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
LIMIT $limit
"""
Then a SyntaxError should be raised at runtime: InvalidArgumentType

Scenario: Floating point parameter for LIMIT with ORDER BY should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
And parameters are:
| limit | 1.5 |
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
ORDER BY name LIMIT $limit
"""
Then a SyntaxError should be raised at runtime: InvalidArgumentType

Scenario: Floating point LIMIT should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
LIMIT 1.5
"""
Then a SyntaxError should be raised at compile time: InvalidArgumentType

Scenario: Floating point parameter for SKIP should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
And parameters are:
| limit | 1.5 |
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
SKIP $limit
"""
Then a SyntaxError should be raised at runtime: InvalidArgumentType

Scenario: Floating point SKIP should fail
And having executed:
"""
CREATE (s:Person {name: 'Steven'}),
(c:Person {name: 'Craig'})
"""
When executing query:
"""
MATCH (p:Person)
RETURN p.name AS name
SKIP 1.5
"""
Then a SyntaxError should be raised at compile time: InvalidArgumentType

0 comments on commit 18fc8ba

Please sign in to comment.