Skip to content

Commit f9e85ec

Browse files
committed
Adds missing test cases
1 parent d5c24f3 commit f9e85ec

3 files changed

Lines changed: 48 additions & 56 deletions

File tree

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(2,5): error TS1005: 'try' expected.
2-
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(8,5): error TS1005: 'try' expected.
3-
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(9,5): error TS1005: 'try' expected.
4-
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(18,5): error TS1005: 'try' expected.
5-
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(22,5): error TS1005: 'try' expected.
2+
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(6,12): error TS1005: 'finally' expected.
3+
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(10,5): error TS1005: 'try' expected.
4+
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(11,5): error TS1005: 'try' expected.
5+
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(15,5): error TS1005: 'try' expected.
6+
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(17,5): error TS1005: 'try' expected.
7+
tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(19,20): error TS1003: Identifier expected.
68

79

8-
==== tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts (5 errors) ====
10+
==== tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts (7 errors) ====
911
function fn() {
1012
catch(x) { } // error missing try
1113
~~~~~
1214
!!! error TS1005: 'try' expected.
1315

14-
finally{ } // potential error; can be absorbed by the 'catch'
16+
finally { } // potential error; can be absorbed by the 'catch'
17+
18+
try { }; // missing finally
19+
~
20+
!!! error TS1005: 'finally' expected.
1521
}
1622

1723
function fn2() {
@@ -21,22 +27,18 @@ tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts(22,5):
2127
catch (x) { } // error missing try
2228
~~~~~
2329
!!! error TS1005: 'try' expected.
30+
31+
try { } finally { } // statement is here, so the 'catch' clause above doesn't absorb errors from the 'finally' clause below
2432

25-
// no error
26-
try {
27-
}
28-
finally {
29-
}
30-
31-
// error missing try
32-
finally {
33+
finally { } // error missing try
3334
~~~~~~~
3435
!!! error TS1005: 'try' expected.
35-
}
36-
37-
// error missing try
38-
catch (x) {
36+
37+
catch (x) { } // error missing try
3938
~~~~~
4039
!!! error TS1005: 'try' expected.
41-
}
40+
41+
try { } catch () { } // error missing catch binding
42+
~
43+
!!! error TS1003: Identifier expected.
4244
}

tests/baselines/reference/invalidTryStatements2.js

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,22 @@
22
function fn() {
33
catch(x) { } // error missing try
44

5-
finally{ } // potential error; can be absorbed by the 'catch'
5+
finally { } // potential error; can be absorbed by the 'catch'
6+
7+
try { }; // missing finally
68
}
79

810
function fn2() {
911
finally { } // error missing try
1012
catch (x) { } // error missing try
13+
14+
try { } finally { } // statement is here, so the 'catch' clause above doesn't absorb errors from the 'finally' clause below
1115

12-
// no error
13-
try {
14-
}
15-
finally {
16-
}
17-
18-
// error missing try
19-
finally {
20-
}
16+
finally { } // error missing try
17+
18+
catch (x) { } // error missing try
2119

22-
// error missing try
23-
catch (x) {
24-
}
20+
try { } catch () { } // error missing catch binding
2521
}
2622

2723
//// [invalidTryStatements2.js]
@@ -30,6 +26,9 @@ function fn() {
3026
}
3127
catch (x) { } // error missing try
3228
finally { } // potential error; can be absorbed by the 'catch'
29+
try { }
30+
finally { }
31+
; // missing finally
3332
}
3433
function fn2() {
3534
try {
@@ -38,19 +37,14 @@ function fn2() {
3837
try {
3938
}
4039
catch (x) { } // error missing try
41-
// no error
40+
try { }
41+
finally { } // statement is here, so the 'catch' clause above doesn't absorb errors from the 'finally' clause below
4242
try {
4343
}
44-
finally {
45-
}
46-
// error missing try
47-
try {
48-
}
49-
finally {
50-
}
51-
// error missing try
44+
finally { } // error missing try
5245
try {
5346
}
54-
catch (x) {
55-
}
47+
catch (x) { } // error missing try
48+
try { }
49+
catch () { } // error missing catch binding
5650
}
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
function fn() {
22
catch(x) { } // error missing try
33

4-
finally{ } // potential error; can be absorbed by the 'catch'
4+
finally { } // potential error; can be absorbed by the 'catch'
5+
6+
try { }; // missing finally
57
}
68

79
function fn2() {
810
finally { } // error missing try
911
catch (x) { } // error missing try
12+
13+
try { } finally { } // statement is here, so the 'catch' clause above doesn't absorb errors from the 'finally' clause below
1014

11-
// no error
12-
try {
13-
}
14-
finally {
15-
}
16-
17-
// error missing try
18-
finally {
19-
}
15+
finally { } // error missing try
16+
17+
catch (x) { } // error missing try
2018

21-
// error missing try
22-
catch (x) {
23-
}
19+
try { } catch () { } // error missing catch binding
2420
}

0 commit comments

Comments
 (0)