mirror of
https://github.com/github/codeql.git
synced 2026-07-20 10:48:17 +02:00
aggregate the tests in library-tests/Patterns into a single .ql file
This commit is contained in:
@@ -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 |
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from ArrayPattern ap, int i, BindingPattern elt
|
||||
where elt = ap.getElement(i)
|
||||
select ap, i, elt
|
||||
@@ -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 |
|
||||
@@ -1,4 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from ArrayPattern ap
|
||||
select ap, ap.getSize()
|
||||
@@ -1 +0,0 @@
|
||||
| tst.js:2:10:2:14 | [, c] | 0 |
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from ArrayPattern ap, int i
|
||||
where ap.elementIsOmitted(i)
|
||||
select ap, i
|
||||
@@ -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 |
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from ObjectPattern op, int i, PropertyPattern pp
|
||||
where pp = op.getPropertyPattern(i)
|
||||
select op, i, pp
|
||||
@@ -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> |
|
||||
@@ -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
|
||||
@@ -1 +0,0 @@
|
||||
| tst.js:11:8:11:13 | [x]: w |
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from PropertyPattern pp
|
||||
where pp.isComputed()
|
||||
select pp
|
||||
@@ -1 +0,0 @@
|
||||
| tst.js:10:14:10:14 | x |
|
||||
@@ -1,5 +0,0 @@
|
||||
import javascript
|
||||
|
||||
from PropertyPattern pp
|
||||
where pp.isShorthand()
|
||||
select pp
|
||||
24
javascript/ql/test/library-tests/Patterns/tests.expected
Normal file
24
javascript/ql/test/library-tests/Patterns/tests.expected
Normal 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 |
|
||||
21
javascript/ql/test/library-tests/Patterns/tests.ql
Normal file
21
javascript/ql/test/library-tests/Patterns/tests.ql
Normal 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() }
|
||||
Reference in New Issue
Block a user