diff --git a/tests/cases/fourslash/getOccurrencesTryCatchFinallyBroken.ts b/tests/cases/fourslash/getOccurrencesTryCatchFinallyBroken.ts new file mode 100644 index 00000000000..c866ed96398 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesTryCatchFinallyBroken.ts @@ -0,0 +1,55 @@ +/// + +////t /*1*/ry { +//// t/*2*/ry { +//// } +//// ctch (x) { +//// } +//// +//// tr { +//// } +//// fin/*3*/ally { +//// } +////} +////c/*4*/atch (e) { +////} +////f/*5*/inally { +////} +//// +////// Missing catch variable +////t/*6*/ry { +////} +////catc/*7*/h { +////} +/////*8*/finally { +////} +//// +////// Missing try entirely +////cat/*9*/ch (x) { +////} +////final/*10*/ly { +////} + + +for (var i = 1; i <= test.markers().length; i++) { + goTo.marker("" + i); + + switch (i) { + case 1: + case 2: + case 3: + verify.occurrencesAtPositionCount(1); + break; + case 4: + case 5: + case 9: + case 10: + verify.occurrencesAtPositionCount(2); + break; + case 6: + case 7: + case 8: + verify.occurrencesAtPositionCount(3); + break; + } +} \ No newline at end of file diff --git a/tests/cases/fourslash/getOccurrencesTryCatchFinallyNegatives.ts b/tests/cases/fourslash/getOccurrencesTryCatchFinallyNegatives.ts new file mode 100644 index 00000000000..d5889ff84e9 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesTryCatchFinallyNegatives.ts @@ -0,0 +1,23 @@ +/// + +////try/*1*/ { +//// try/*2*/ { +//// } +//// catch/*3*/ (x) { +//// } +//// +//// try/*4*/ { +//// } +//// finally/*5*/ {/*8*/ +//// } +////} +////catch/*6*/ (e) { +////} +////finally/*7*/ { +////} + + +for (var i = 1; i <= test.markers().length; i++) { + goTo.marker("" + i); + verify.occurrencesAtPositionCount(0); +} \ No newline at end of file