mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
aggregate the tests in library-tests/Util into a single .ql file
This commit is contained in:
@@ -1 +0,0 @@
|
||||
| X | X | Xx | XX | Xx | XX |
|
||||
@@ -1,4 +0,0 @@
|
||||
import semmle.javascript.Util
|
||||
|
||||
select capitalize("x"), capitalize("X"), capitalize("xx"), capitalize("XX"), capitalize("Xx"),
|
||||
capitalize("xX")
|
||||
@@ -1,4 +0,0 @@
|
||||
import semmle.javascript.Util
|
||||
|
||||
from Expr e
|
||||
select e, describeExpression(e)
|
||||
@@ -1 +0,0 @@
|
||||
| xs | x | xs | xs |
|
||||
@@ -1,3 +0,0 @@
|
||||
import semmle.javascript.Util
|
||||
|
||||
select pluralize("x", 0), pluralize("x", 1), pluralize("x", 2), pluralize("x", -1)
|
||||
@@ -1,3 +1,11 @@
|
||||
capitalize
|
||||
| X | X |
|
||||
| X | x |
|
||||
| XX | XX |
|
||||
| XX | xX |
|
||||
| Xx | Xx |
|
||||
| Xx | xx |
|
||||
describeExpression
|
||||
| tst.js:1:1:15:2 | (functi ... !'';\\n}) | expression |
|
||||
| tst.js:1:2:15:1 | functio ... !'';\\n} | expression |
|
||||
| tst.js:2:5:2:5 | v | use of variable 'v' |
|
||||
@@ -34,3 +42,10 @@
|
||||
| tst.js:13:7:13:9 | 'x' | expression |
|
||||
| tst.js:14:5:14:7 | !'' | negation |
|
||||
| tst.js:14:6:14:7 | '' | expression |
|
||||
test_pluralize
|
||||
| x | 1 |
|
||||
| xs | 0 |
|
||||
| xs | 2 |
|
||||
| xs | -1 |
|
||||
#select
|
||||
| y | | X | XX | XXy |
|
||||
18
javascript/ql/test/library-tests/Util/tests.ql
Normal file
18
javascript/ql/test/library-tests/Util/tests.ql
Normal file
@@ -0,0 +1,18 @@
|
||||
import javascript
|
||||
|
||||
query predicate capitalize(string cap, string s) {
|
||||
s = ["x", "X", "xx", "XX", "Xx", "xX"] and
|
||||
cap = capitalize(s)
|
||||
}
|
||||
|
||||
query predicate describeExpression(Expr e, string description) {
|
||||
description = describeExpression(e)
|
||||
}
|
||||
|
||||
query predicate test_pluralize(string res, int num) {
|
||||
num = [0, 1, 2, -1] and
|
||||
res = pluralize("x", num)
|
||||
}
|
||||
|
||||
select truncate("X", 0, "y"), truncate("", 2, "y"), truncate("X", 2, "y"), truncate("XX", 2, "y"),
|
||||
truncate("XXX", 2, "y")
|
||||
@@ -1 +0,0 @@
|
||||
| y | | X | XX | XXy |
|
||||
@@ -1,4 +0,0 @@
|
||||
import semmle.javascript.Util
|
||||
|
||||
select truncate("X", 0, "y"), truncate("", 2, "y"), truncate("X", 2, "y"), truncate("XX", 2, "y"),
|
||||
truncate("XXX", 2, "y")
|
||||
Reference in New Issue
Block a user