Add regression tests

Report unreachable code in JS files when --checkjs is passed, but not
otherwise.
This commit is contained in:
Andrew Casey 2017-06-01 17:04:42 -07:00
parent 9d0bbc4e44
commit 01d6d489be
7 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,10 @@
tests/cases/compiler/unreachable.js(3,5): error TS7027: Unreachable code detected.
==== tests/cases/compiler/unreachable.js (1 errors) ====
function unreachable() {
return 1;
return 2;
~~~~~~
!!! error TS7027: Unreachable code detected.
}

View file

@ -0,0 +1,11 @@
//// [unreachable.js]
function unreachable() {
return 1;
return 2;
}
//// [unreachable.js]
function unreachable() {
return 1;
return 2;
}

View file

@ -0,0 +1,11 @@
//// [unreachable.js]
function unreachable() {
return 1;
return 2;
}
//// [unreachable.js]
function unreachable() {
return 1;
return 2;
}

View file

@ -0,0 +1,7 @@
=== tests/cases/compiler/unreachable.js ===
function unreachable() {
>unreachable : Symbol(unreachable, Decl(unreachable.js, 0, 0))
return 1;
return 2;
}

View file

@ -0,0 +1,10 @@
=== tests/cases/compiler/unreachable.js ===
function unreachable() {
>unreachable : () => 1 | 2
return 1;
>1 : 1
return 2;
>2 : 2
}

View file

@ -0,0 +1,8 @@
// @Filename: unreachable.js
// @allowJs: true
// @checkJs: true
// @outDir: out
function unreachable() {
return 1;
return 2;
}

View file

@ -0,0 +1,8 @@
// @Filename: unreachable.js
// @allowJs: true
// @checkJs: false
// @outDir: out
function unreachable() {
return 1;
return 2;
}