Skip to content

Commit 835c9bb

Browse files
committed
JS: Add test
1 parent a0d3a6b commit 835c9bb

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

javascript/ql/test/library-tests/TypeTracking/TypeTracking.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ from Locatable loc, File f, int l, string name, string msg
3434
where
3535
expected(loc, f, l, name) and
3636
not actual(_, f, l, name) and
37+
name != "none" and
3738
msg = "Failed to track " + name + " here."
3839
or
3940
actual(loc, f, l, name) and
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const lib = require('testlib');
2+
3+
function foo() {
4+
return lib.foo(); // name: raw-await-source
5+
}
6+
7+
async function test() {
8+
const x = await foo();
9+
const y = await x;
10+
const z = await y;
11+
z; // track: raw-await-source
12+
}
13+
14+
async function exceptionThrower() {
15+
throw {}; // name: raw-await-err
16+
}
17+
18+
async function exceptionReThrower() {
19+
const x = await exceptionThrower();
20+
const y = x.catch(err => {
21+
err; // track: none
22+
});
23+
return y;
24+
}
25+
26+
async function exceptionCatcher() {
27+
try {
28+
await exceptionThrower();
29+
} catch (err) {
30+
err; // track: raw-await-err
31+
}
32+
}

0 commit comments

Comments
 (0)