Skip to content

Commit e295c3a

Browse files
committed
JS: Add JSDoc test
1 parent 6b2b64c commit e295c3a

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
test_isString
2+
| string |
3+
test_isNumber
4+
| number |
5+
test_QualifiedName
6+
| VarType | VarType |
7+
| boolean | boolean |
8+
| foo.bar.baz | foo.bar.baz |
9+
| number | number |
10+
| string | string |
11+
test_ParameterType
12+
| tst.js:7:12:7:12 | x | string |
13+
| tst.js:7:15:7:15 | y | number? |
14+
| tst.js:7:18:7:18 | z | foo.bar.baz |
15+
test_VarType
16+
| tst.js:7:12:7:12 | x | string |
17+
| tst.js:7:15:7:15 | y | number? |
18+
| tst.js:7:18:7:18 | z | foo.bar.baz |
19+
| tst.js:11:7:11:7 | w | VarType |
20+
test_ReturnType
21+
| tst.js:7:1:12:1 | functio ... null;\\n} | boolean |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import javascript
2+
3+
query TypeAnnotation test_isString() {
4+
result.isString()
5+
}
6+
7+
query TypeAnnotation test_isNumber() {
8+
result.isNumber()
9+
}
10+
11+
query TypeAnnotation test_QualifiedName(string name) {
12+
result.hasQualifiedName(name)
13+
}
14+
15+
query TypeAnnotation test_ParameterType(Parameter p) {
16+
result = p.getTypeAnnotation()
17+
}
18+
19+
query TypeAnnotation test_VarType(VarDecl decl) {
20+
result = decl.getTypeAnnotation()
21+
}
22+
23+
query TypeAnnotation test_ReturnType(Function f) {
24+
result = f.getReturnTypeAnnotation()
25+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @param {string} x
3+
* @param {number?} y
4+
* @param {foo.bar.baz} z
5+
* @returns {boolean}
6+
*/
7+
function f(x, y, z) {
8+
/**
9+
* @type {VarType}
10+
*/
11+
var w = null;
12+
}

0 commit comments

Comments
 (0)