Debian Codegraph @

packages/babel-plugin-transform-block-scoping/test/fixtures/general/block-inside-switch-inside-loop/exec.js

raw symbols SCIP
1 // it shouldn't break on a case-break statement
2 var i;
3 for (i = 0; i < 10; i++) {
4 switch (i) {
5 case 1: {
6 break;
7 }
8 }
9
10 const z = 3; // to force the plugin to convert to loop function call
11 () => z;
12 }
13
14 expect(i).toBe(10);
15
16 // it should continue on continue statements within switch
17 var j = 0;
18 for (i = 0; i < 10; i++) {
19 switch (i) {
20 case 0: {
21 continue;
22 }
23 }
24 j++;
25
26 const z = 3;
27 () => z;
28 }
29
30 expect(j).toBe(9);
31
32 // it should work with loops nested within switch
33 j = 0;
34 for (i = 0; i < 10; i++) {
35 switch (i) {
36 case 0: {
37 for (var k = 0; k < 10; k++) {
38 const z = 3;
39 () => z;
40 j++;
41 break;
42 }
43 break;
44 }
45 }
46
47 const z = 3;
48 () => z;
49 }
50
51 expect(j).toBe(1);