mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: Add regression tests
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
| module-environment-detection.js:23:8:23:36 | typeof ... efined' | This guard always evaluates to true. |
|
||||
| regression.js:9:9:9:12 | date | This guard always evaluates to true. |
|
||||
| regression.js:13:25:13:40 | obj != undefined | This guard always evaluates to true. |
|
||||
| tst2.js:4:12:4:35 | typeof ... efined" | This guard always evaluates to true. |
|
||||
| tst.js:18:5:18:5 | u | This guard always evaluates to false. |
|
||||
| tst.js:19:5:19:5 | n | This guard always evaluates to false. |
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
function getDate() {
|
||||
var date;
|
||||
if (something()) {
|
||||
date = new Date();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
console.log(date);
|
||||
return date && date.getTime(); // NOT OK
|
||||
}
|
||||
|
||||
function isNotNullOrString(obj) {
|
||||
return obj != null && obj != undefined && // NOT OK
|
||||
typeof obj != 'string';
|
||||
}
|
||||
Reference in New Issue
Block a user