aggregate the tests in library-tests/Patterns into a single .ql file

This commit is contained in:
Erik Krogh Kristensen
2020-10-14 14:34:28 +02:00
parent a47b8c30d1
commit bc5ed100a0
16 changed files with 45 additions and 51 deletions

View File

@@ -1,5 +0,0 @@
| tst.js:1:12:1:17 | [x, y] | 0 | tst.js:1:13:1:13 | x |
| tst.js:1:12:1:17 | [x, y] | 1 | tst.js:1:16:1:16 | y |
| tst.js:2:6:2:15 | [a, [, c]] | 0 | tst.js:2:7:2:7 | a |
| tst.js:2:6:2:15 | [a, [, c]] | 1 | tst.js:2:10:2:14 | [, c] |
| tst.js:2:10:2:14 | [, c] | 1 | tst.js:2:13:2:13 | c |

View File

@@ -1,5 +0,0 @@
import javascript
from ArrayPattern ap, int i, BindingPattern elt
where elt = ap.getElement(i)
select ap, i, elt

View File

@@ -1,3 +0,0 @@
| tst.js:1:12:1:17 | [x, y] | 2 |
| tst.js:2:6:2:15 | [a, [, c]] | 2 |
| tst.js:2:10:2:14 | [, c] | 2 |

View File

@@ -1,4 +0,0 @@
import javascript
from ArrayPattern ap
select ap, ap.getSize()

View File

@@ -1 +0,0 @@
| tst.js:2:10:2:14 | [, c] | 0 |

View File

@@ -1,5 +0,0 @@
import javascript
from ArrayPattern ap, int i
where ap.elementIsOmitted(i)
select ap, i

View File

@@ -1,3 +0,0 @@
| tst.js:10:12:10:22 | { x, y: z } | 0 | tst.js:10:14:10:14 | x |
| tst.js:10:12:10:22 | { x, y: z } | 1 | tst.js:10:17:10:20 | y: z |
| tst.js:11:6:11:15 | { [x]: w } | 0 | tst.js:11:8:11:13 | [x]: w |

View File

@@ -1,5 +0,0 @@
import javascript
from ObjectPattern op, int i, PropertyPattern pp
where pp = op.getPropertyPattern(i)
select op, i, pp

View File

@@ -1,3 +0,0 @@
| tst.js:10:14:10:14 | x | x |
| tst.js:10:17:10:20 | y: z | y |
| tst.js:11:8:11:13 | [x]: w | <unknown> |

View File

@@ -1,5 +0,0 @@
import javascript
from PropertyPattern pp, string name
where (if exists(pp.getName()) then name = pp.getName() else name = "<unknown>")
select pp, name

View File

@@ -1 +0,0 @@
| tst.js:11:8:11:13 | [x]: w |

View File

@@ -1,5 +0,0 @@
import javascript
from PropertyPattern pp
where pp.isComputed()
select pp

View File

@@ -1 +0,0 @@
| tst.js:10:14:10:14 | x |

View File

@@ -1,5 +0,0 @@
import javascript
from PropertyPattern pp
where pp.isShorthand()
select pp

View File

@@ -0,0 +1,24 @@
arrayPattern_getElement
| tst.js:1:12:1:17 | [x, y] | 0 | tst.js:1:13:1:13 | x |
| tst.js:1:12:1:17 | [x, y] | 1 | tst.js:1:16:1:16 | y |
| tst.js:2:6:2:15 | [a, [, c]] | 0 | tst.js:2:7:2:7 | a |
| tst.js:2:6:2:15 | [a, [, c]] | 1 | tst.js:2:10:2:14 | [, c] |
| tst.js:2:10:2:14 | [, c] | 1 | tst.js:2:13:2:13 | c |
arrayPattern_getSizeE
| tst.js:1:12:1:17 | [x, y] | 2 |
| tst.js:2:6:2:15 | [a, [, c]] | 2 |
| tst.js:2:10:2:14 | [, c] | 2 |
arrayPattern_omittedElements
| tst.js:2:10:2:14 | [, c] | 0 |
objectPattern_getPropertyPattern
| tst.js:10:12:10:22 | { x, y: z } | 0 | tst.js:10:14:10:14 | x |
| tst.js:10:12:10:22 | { x, y: z } | 1 | tst.js:10:17:10:20 | y: z |
| tst.js:11:6:11:15 | { [x]: w } | 0 | tst.js:11:8:11:13 | [x]: w |
propertyPattern_getName
| tst.js:10:14:10:14 | x | x |
| tst.js:10:17:10:20 | y: z | y |
| tst.js:11:8:11:13 | [x]: w | <unknown> |
propertyPattern_isComputed
| tst.js:11:8:11:13 | [x]: w |
propertyPattern_isShortHand
| tst.js:10:14:10:14 | x |

View File

@@ -0,0 +1,21 @@
import javascript
query predicate arrayPattern_getElement(ArrayPattern ap, int i, BindingPattern elt) {
elt = ap.getElement(i)
}
query predicate arrayPattern_getSizeE(ArrayPattern ap, int size) { size = ap.getSize() }
query predicate arrayPattern_omittedElements(ArrayPattern ap, int i) { ap.elementIsOmitted(i) }
query predicate objectPattern_getPropertyPattern(ObjectPattern op, int i, PropertyPattern pp) {
pp = op.getPropertyPattern(i)
}
query predicate propertyPattern_getName(PropertyPattern pp, string name) {
if exists(pp.getName()) then name = pp.getName() else name = "<unknown>"
}
query predicate propertyPattern_isComputed(PropertyPattern pp) { pp.isComputed() }
query predicate propertyPattern_isShortHand(PropertyPattern pp) { pp.isShorthand() }