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

This commit is contained in:
Erik Krogh Kristensen
2020-10-20 13:05:56 +02:00
parent ad7844a6ac
commit d678cc17ba
11 changed files with 59 additions and 60 deletions

View File

@@ -1,3 +0,0 @@
| folding.js:1:1:1:3 | `x` | x |
| folding.js:17:1:17:8 | `${"x"}` | x |
| templates.js:9:1:9:2 | `` | |

View File

@@ -1,4 +0,0 @@
import javascript
from TemplateLiteral t
select t, t.getStringValue()

View File

@@ -1,2 +0,0 @@
| templates-revised.js:1:1:1:30 | tag `\\u ... quence` | templates-revised.js:1:1:1:3 | tag | templates-revised.js:1:5:1:30 | `\\unval ... quence` |
| templates.js:8:1:8:30 | tag `${ ... x + y}` | templates.js:8:1:8:3 | tag | templates.js:8:5:8:30 | `${x} + ... x + y}` |

View File

@@ -1,4 +0,0 @@
import javascript
from TaggedTemplateExpr tte
select tte, tte.getTag(), tte.getTemplate()

View File

@@ -1,17 +0,0 @@
| folding.js:1:2:1:2 | x | x |
| folding.js:4:6:4:6 | | |
| folding.js:6:2:6:3 | x | x |
| folding.js:8:2:8:3 | x | x |
| folding.js:8:8:8:9 | x | x |
| folding.js:10:2:10:3 | x | x |
| folding.js:10:8:10:10 | x | x |
| folding.js:18:8:18:8 | | |
| folding.js:20:2:20:3 | x | x |
| folding.js:22:2:22:3 | x | x |
| folding.js:22:10:22:11 | x | x |
| folding.js:24:2:24:3 | x | x |
| folding.js:24:10:24:12 | x | x |
| templates.js:7:6:7:8 | + | + |
| templates.js:7:13:7:15 | = | = |
| templates.js:8:10:8:12 | + | + |
| templates.js:8:17:8:21 | =\\n | =\n |

View File

@@ -1,4 +0,0 @@
import javascript
from TemplateElement te
select te, te.getValue()

View File

@@ -1,18 +0,0 @@
| folding.js:1:2:1:2 | x | x |
| folding.js:4:6:4:6 | | |
| folding.js:6:2:6:3 | x | x |
| folding.js:8:2:8:3 | x | x |
| folding.js:8:8:8:9 | x | x |
| folding.js:10:2:10:3 | x | x |
| folding.js:10:8:10:10 | x | x |
| folding.js:18:8:18:8 | | |
| folding.js:20:2:20:3 | x | x |
| folding.js:22:2:22:3 | x | x |
| folding.js:22:10:22:11 | x | x |
| folding.js:24:2:24:3 | x | x |
| folding.js:24:10:24:12 | x | x |
| templates-revised.js:1:6:1:29 | \\unvali ... equence | \\unvalid escape sequence |
| templates.js:7:6:7:8 | + | + |
| templates.js:7:13:7:15 | = | = |
| templates.js:8:10:8:12 | + | + |
| templates.js:8:17:8:21 | =\\n | =\\n |

View File

@@ -1,4 +0,0 @@
import javascript
from TemplateElement te
select te, te.getRawValue()

View File

@@ -1,4 +0,0 @@
import javascript
from TemplateLiteral tl, int i
select tl, i, tl.getElement(i)

View File

@@ -1,3 +1,48 @@
folding
| folding.js:1:1:1:3 | `x` | x |
| folding.js:17:1:17:8 | `${"x"}` | x |
| templates.js:9:1:9:2 | `` | |
taggedTemplateExpr
| templates-revised.js:1:1:1:30 | tag `\\u ... quence` | templates-revised.js:1:1:1:3 | tag | templates-revised.js:1:5:1:30 | `\\unval ... quence` |
| templates.js:8:1:8:30 | tag `${ ... x + y}` | templates.js:8:1:8:3 | tag | templates.js:8:5:8:30 | `${x} + ... x + y}` |
templateElementCookedValue
| folding.js:1:2:1:2 | x | x |
| folding.js:4:6:4:6 | | |
| folding.js:6:2:6:3 | x | x |
| folding.js:8:2:8:3 | x | x |
| folding.js:8:8:8:9 | x | x |
| folding.js:10:2:10:3 | x | x |
| folding.js:10:8:10:10 | x | x |
| folding.js:18:8:18:8 | | |
| folding.js:20:2:20:3 | x | x |
| folding.js:22:2:22:3 | x | x |
| folding.js:22:10:22:11 | x | x |
| folding.js:24:2:24:3 | x | x |
| folding.js:24:10:24:12 | x | x |
| templates.js:7:6:7:8 | + | + |
| templates.js:7:13:7:15 | = | = |
| templates.js:8:10:8:12 | + | + |
| templates.js:8:17:8:21 | =\\n | =\n |
templateElementRawValue
| folding.js:1:2:1:2 | x | x |
| folding.js:4:6:4:6 | | |
| folding.js:6:2:6:3 | x | x |
| folding.js:8:2:8:3 | x | x |
| folding.js:8:8:8:9 | x | x |
| folding.js:10:2:10:3 | x | x |
| folding.js:10:8:10:10 | x | x |
| folding.js:18:8:18:8 | | |
| folding.js:20:2:20:3 | x | x |
| folding.js:22:2:22:3 | x | x |
| folding.js:22:10:22:11 | x | x |
| folding.js:24:2:24:3 | x | x |
| folding.js:24:10:24:12 | x | x |
| templates-revised.js:1:6:1:29 | \\unvali ... equence | \\unvalid escape sequence |
| templates.js:7:6:7:8 | + | + |
| templates.js:7:13:7:15 | = | = |
| templates.js:8:10:8:12 | + | + |
| templates.js:8:17:8:21 | =\\n | =\\n |
templateLiteral
| folding.js:1:1:1:3 | `x` | 0 | folding.js:1:2:1:2 | x |
| folding.js:3:1:3:6 | `${v}` | 0 | folding.js:3:4:3:4 | v |
| folding.js:4:1:4:11 | `${v} ${v}` | 0 | folding.js:4:4:4:4 | v |

View File

@@ -0,0 +1,14 @@
import javascript
query predicate folding(TemplateLiteral t, string str) { str = t.getStringValue() }
query predicate taggedTemplateExpr(TaggedTemplateExpr tte, Expr tag, TemplateLiteral template) {
tag = tte.getTag() and
template = tte.getTemplate()
}
query predicate templateElementCookedValue(TemplateElement te, string val) { te.getValue() = val }
query predicate templateElementRawValue(TemplateElement te, string raw) { raw = te.getRawValue() }
query predicate templateLiteral(TemplateLiteral tl, int i, Expr e) { tl.getElement(i) = e }