mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
JS: Add test
This commit is contained in:
@@ -34,6 +34,7 @@ from Locatable loc, File f, int l, string name, string msg
|
||||
where
|
||||
expected(loc, f, l, name) and
|
||||
not actual(_, f, l, name) and
|
||||
name != "none" and
|
||||
msg = "Failed to track " + name + " here."
|
||||
or
|
||||
actual(loc, f, l, name) and
|
||||
|
||||
32
javascript/ql/test/library-tests/TypeTracking/raw-await.js
Normal file
32
javascript/ql/test/library-tests/TypeTracking/raw-await.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const lib = require('testlib');
|
||||
|
||||
function foo() {
|
||||
return lib.foo(); // name: raw-await-source
|
||||
}
|
||||
|
||||
async function test() {
|
||||
const x = await foo();
|
||||
const y = await x;
|
||||
const z = await y;
|
||||
z; // track: raw-await-source
|
||||
}
|
||||
|
||||
async function exceptionThrower() {
|
||||
throw {}; // name: raw-await-err
|
||||
}
|
||||
|
||||
async function exceptionReThrower() {
|
||||
const x = await exceptionThrower();
|
||||
const y = x.catch(err => {
|
||||
err; // track: none
|
||||
});
|
||||
return y;
|
||||
}
|
||||
|
||||
async function exceptionCatcher() {
|
||||
try {
|
||||
await exceptionThrower();
|
||||
} catch (err) {
|
||||
err; // track: raw-await-err
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user