Skip to content

Commit

Permalink
Merge pull request #310 from petraselmer/ListOpsFeature
Browse files Browse the repository at this point in the history
List Operations TCK
  • Loading branch information
sherfert authored Jun 11, 2018
2 parents 3e00b6d + 1d68535 commit b60f0f8
Show file tree
Hide file tree
Showing 5 changed files with 818 additions and 221 deletions.
125 changes: 1 addition & 124 deletions tck/features/ExpressionAcceptance.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,58 +33,6 @@ Feature: ExpressionAcceptance
Background:
Given any graph

Scenario: IN should work with nested list subscripting
When executing query:
"""
WITH [[1, 2, 3]] AS list
RETURN 3 IN list[0] AS r
"""
Then the result should be:
| r |
| true |
And no side effects

Scenario: IN should work with nested literal list subscripting
When executing query:
"""
RETURN 3 IN [[1, 2, 3]][0] AS r
"""
Then the result should be:
| r |
| true |
And no side effects

Scenario: IN should work with list slices
When executing query:
"""
WITH [1, 2, 3] AS list
RETURN 3 IN list[0..1] AS r
"""
Then the result should be:
| r |
| false |
And no side effects

Scenario: IN should work with literal list slices
When executing query:
"""
RETURN 3 IN [1, 2, 3][0..1] AS r
"""
Then the result should be:
| r |
| false |
And no side effects

Scenario: Execute n[0]
When executing query:
"""
RETURN [1, 2, 3][0] AS value
"""
Then the result should be:
| value |
| 1 |
And no side effects

Scenario: Execute n['name'] in read queries
And having executed:
"""
Expand Down Expand Up @@ -156,47 +104,6 @@ Feature: ExpressionAcceptance
| 'Apa' |
And no side effects

Scenario: Use collection lookup based on parameters when there is no type information
And parameters are:
| expr | ['Apa'] |
| idx | 0 |
When executing query:
"""
WITH $expr AS expr, $idx AS idx
RETURN expr[idx] AS value
"""
Then the result should be:
| value |
| 'Apa' |
And no side effects

Scenario: Use collection lookup based on parameters when there is lhs type information
And parameters are:
| idx | 0 |
When executing query:
"""
WITH ['Apa'] AS expr
RETURN expr[$idx] AS value
"""
Then the result should be:
| value |
| 'Apa' |
And no side effects

Scenario: Use collection lookup based on parameters when there is rhs type information
And parameters are:
| expr | ['Apa'] |
| idx | 0 |
When executing query:
"""
WITH $expr AS expr, $idx AS idx
RETURN expr[toInteger(idx)] AS value
"""
Then the result should be:
| value |
| 'Apa' |
And no side effects

Scenario: Fail at runtime when attempting to index with an Int into a Map
And parameters are:
| expr | {name: 'Apa'} |
Expand All @@ -219,37 +126,7 @@ Feature: ExpressionAcceptance
"""
Then a TypeError should be raised at runtime: MapElementAccessByNonString

Scenario: Fail at runtime when attempting to index with a String into a Collection
And parameters are:
| expr | ['Apa'] |
| idx | 'name' |
When executing query:
"""
WITH $expr AS expr, $idx AS idx
RETURN expr[idx]
"""
Then a TypeError should be raised at runtime: ListElementAccessByNonInteger

Scenario: Fail at runtime when trying to index into a list with a list
And parameters are:
| expr | ['Apa'] |
| idx | ['Apa'] |
When executing query:
"""
WITH $expr AS expr, $idx AS idx
RETURN expr[idx]
"""
Then a TypeError should be raised at runtime: ListElementAccessByNonInteger

Scenario: Fail at compile time when attempting to index with a non-integer into a list
When executing query:
"""
WITH [1, 2, 3, 4, 5] AS list, 3.14 AS idx
RETURN list[idx]
"""
Then a SyntaxError should be raised at compile time: InvalidArgumentType

Scenario: Fail at runtime when trying to index something which is not a map or collection
Scenario: Fail at runtime when trying to index something which is not a map or list
And parameters are:
| expr | 100 |
| idx | 0 |
Expand Down
Loading

0 comments on commit b60f0f8

Please sign in to comment.