Skip to content

Commit d98a11e

Browse files
Modified tests and added a test for labeled continues in a switch block.
1 parent 2e2d0c3 commit d98a11e

9 files changed

+54
-28
lines changed

tests/cases/fourslash/getOccurrencesLoopBreakContinue.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@
6565

6666
test.ranges().forEach(r => {
6767
goTo.position(r.start);
68+
verify.occurrencesAtPositionCount(test.ranges().length);
6869

6970
test.ranges().forEach(range => {
7071
verify.occurrencesAtPositionContains(range, false);
7172
});
7273
});
7374

7475
goTo.marker();
76+
verify.occurrencesAtPositionCount(test.ranges().length);
7577
test.ranges().forEach(range => {
7678
verify.occurrencesAtPositionContains(range, false);
7779
});

tests/cases/fourslash/getOccurrencesLoopBreakContinue2.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@
6565

6666
test.ranges().forEach(r => {
6767
goTo.position(r.start);
68+
verify.occurrencesAtPositionCount(test.ranges().length);
6869

6970
test.ranges().forEach(range => {
7071
verify.occurrencesAtPositionContains(range, false);
7172
});
7273
});
7374

7475
goTo.marker();
76+
verify.occurrencesAtPositionCount(test.ranges().length);
7577
test.ranges().forEach(range => {
7678
verify.occurrencesAtPositionContains(range, false);
7779
});

tests/cases/fourslash/getOccurrencesLoopBreakContinue3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
test.ranges().forEach(r => {
6767
goTo.position(r.start);
68+
verify.occurrencesAtPositionCount(test.ranges().length);
6869

6970
test.ranges().forEach(range => {
7071
verify.occurrencesAtPositionContains(range, false);

tests/cases/fourslash/getOccurrencesLoopBreakContinue4.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@
6565

6666
test.ranges().forEach(r => {
6767
goTo.position(r.start);
68+
verify.occurrencesAtPositionCount(test.ranges().length);
6869

6970
test.ranges().forEach(range => {
7071
verify.occurrencesAtPositionContains(range, false);
7172
});
7273
});
7374

7475
goTo.marker();
76+
verify.occurrencesAtPositionCount(test.ranges().length);
7577
test.ranges().forEach(range => {
7678
verify.occurrencesAtPositionContains(range, false);
7779
});

tests/cases/fourslash/getOccurrencesLoopBreakContinue5.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@
6565

6666
test.ranges().forEach(r => {
6767
goTo.position(r.start);
68+
verify.occurrencesAtPositionCount(test.ranges().length);
6869

6970
test.ranges().forEach(range => {
7071
verify.occurrencesAtPositionContains(range, false);
7172
});
7273
});
7374

7475
goTo.marker();
76+
verify.occurrencesAtPositionCount(test.ranges().length);
7577
test.ranges().forEach(range => {
7678
verify.occurrencesAtPositionContains(range, false);
7779
});
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
/// <reference path='fourslash.ts' />
22

3-
////[|sw/*1*/itch|] (10) {
4-
//// [|/*2*/case|] 1:
5-
//// [|cas/*3*/e|] 2:
6-
//// [|c/*4*/ase|] 4:
7-
//// [|c/*5*/ase|] 8:
3+
////[|switch|] (10) {
4+
//// [|case|] 1:
5+
//// [|case|] 2:
6+
//// [|case|] 4:
7+
//// [|case|] 8:
88
//// foo: switch (20) {
99
//// case 1:
1010
//// case 2:
1111
//// break;
1212
//// default:
1313
//// break foo;
1414
//// }
15-
//// [|cas/*6*/e|] 0xBEEF:
16-
//// [|defa/*7*/ult|]:
17-
//// [|bre/*9*/ak|];
18-
//// [|/*8*/case|] 16:
15+
//// [|case|] 0xBEEF:
16+
//// [|default|]:
17+
//// [|break|];
18+
//// [|case|] 16:
1919
////}
2020

2121

22-
for (var i = 1; i <= test.markers().length; i++) {
23-
goTo.marker("" + i);
24-
verify.occurrencesAtPositionCount(9);
22+
test.ranges().forEach(r => {
23+
goTo.position(r.start);
24+
verify.occurrencesAtPositionCount(test.ranges().length);
2525

2626
test.ranges().forEach(range => {
2727
verify.occurrencesAtPositionContains(range, false);
2828
});
29-
}
29+
});

tests/cases/fourslash/getOccurrencesSwitchCaseDefault2.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
//// case 2:
66
//// case 4:
77
//// case 8:
8-
//// foo: [|swi/*1*/tch|] (20) {
9-
//// [|/*2*/case|] 1:
10-
//// [|cas/*3*/e|] 2:
11-
//// [|b/*4*/reak|];
12-
//// [|defaul/*5*/t|]:
8+
//// foo: [|switch|] (20) {
9+
//// [|case|] 1:
10+
//// [|case|] 2:
11+
//// [|break|];
12+
//// [|default|]:
1313
//// [|break|] foo;
1414
//// }
1515
//// case 0xBEEF:
@@ -21,18 +21,9 @@
2121

2222
test.ranges().forEach(r => {
2323
goTo.position(r.start);
24+
verify.occurrencesAtPositionCount(test.ranges().length);
2425

2526
test.ranges().forEach(range => {
2627
verify.occurrencesAtPositionContains(range, false);
2728
});
2829
});
29-
30-
31-
for (var i = 1; i <= test.markers().length; i++) {
32-
goTo.marker("" + i);
33-
verify.occurrencesAtPositionCount(6);
34-
35-
test.ranges().forEach(range => {
36-
verify.occurrencesAtPositionContains(range, false);
37-
});
38-
}

tests/cases/fourslash/getOccurrencesSwitchCaseDefault3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
test.ranges().forEach(r => {
2020
goTo.position(r.start);
21+
verify.occurrencesAtPositionCount(test.ranges().length);
2122

2223
test.ranges().forEach(range => {
2324
verify.occurrencesAtPositionContains(range, false);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////foo: [|switch|] (10) {
4+
//// [|case|] 1:
5+
//// [|case|] 2:
6+
//// [|case|] 3:
7+
//// [|break|];
8+
//// [|break|] foo;
9+
//// co/*1*/ntinue;
10+
//// contin/*2*/ue foo;
11+
////}
12+
13+
test.ranges().forEach(r => {
14+
goTo.position(r.start);
15+
verify.occurrencesAtPositionCount(test.ranges().length);
16+
17+
test.ranges().forEach(range => {
18+
verify.occurrencesAtPositionContains(range, false);
19+
});
20+
});
21+
22+
test.markers().forEach(m => {
23+
goTo.position(m.position);
24+
verify.occurrencesAtPositionCount(0);
25+
});

0 commit comments

Comments
 (0)