JS: Add regression tests

This commit is contained in:
Asger Feldthaus
2020-06-25 11:10:27 +01:00
parent a109c1fc96
commit f9b796231b
2 changed files with 17 additions and 0 deletions

View File

@@ -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. |

View File

@@ -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';
}