Skip to content

Commit ce66836

Browse files
authored
Merge pull request glayzzle#365 from glayzzle/test-break-and-continue
test: break and continue
2 parents 62e47cc + 30cdb7c commit ce66836

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

test/snapshot/__snapshots__/break.test.js.snap

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,37 @@ Program {
6060
"kind": "program",
6161
}
6262
`;
63+
64+
exports[`break with parens 1`] = `
65+
Program {
66+
"children": Array [
67+
Break {
68+
"kind": "break",
69+
"level": Number {
70+
"kind": "number",
71+
"parenthesizedExpression": true,
72+
"value": "1",
73+
},
74+
},
75+
],
76+
"errors": Array [],
77+
"kind": "program",
78+
}
79+
`;
80+
81+
exports[`break with var 1`] = `
82+
Program {
83+
"children": Array [
84+
Break {
85+
"kind": "break",
86+
"level": Variable {
87+
"curly": false,
88+
"kind": "variable",
89+
"name": "var",
90+
},
91+
},
92+
],
93+
"errors": Array [],
94+
"kind": "program",
95+
}
96+
`;

test/snapshot/__snapshots__/continue.test.js.snap

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,37 @@ Program {
6060
"kind": "program",
6161
}
6262
`;
63+
64+
exports[`continue with expression 1`] = `
65+
Program {
66+
"children": Array [
67+
Continue {
68+
"kind": "continue",
69+
"level": Variable {
70+
"curly": false,
71+
"kind": "variable",
72+
"name": "var",
73+
},
74+
},
75+
],
76+
"errors": Array [],
77+
"kind": "program",
78+
}
79+
`;
80+
81+
exports[`continue with parens 1`] = `
82+
Program {
83+
"children": Array [
84+
Continue {
85+
"kind": "continue",
86+
"level": Number {
87+
"kind": "number",
88+
"parenthesizedExpression": true,
89+
"value": "1",
90+
},
91+
},
92+
],
93+
"errors": Array [],
94+
"kind": "program",
95+
}
96+
`;

test/snapshot/break.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@ describe('break', () => {
1313
it('argument 2', () => {
1414
expect(parser.parseEval('break 2;')).toMatchSnapshot();
1515
});
16+
it('with parens', () => {
17+
expect(parser.parseEval('break (1);')).toMatchSnapshot();
18+
});
19+
// Deprecated since 5.4.0
20+
it('with expression', () => {
21+
expect(parser.parseEval('break $var;')).toMatchSnapshot();
22+
});
1623
});

test/snapshot/continue.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@ describe('continue', () => {
1313
it('argument 2', () => {
1414
expect(parser.parseEval('continue 2;')).toMatchSnapshot();
1515
});
16+
it('with parens', () => {
17+
expect(parser.parseEval('continue (1);')).toMatchSnapshot();
18+
});
19+
// Deprecated since 5.4.0
20+
it('with expression', () => {
21+
expect(parser.parseEval('continue $var;')).toMatchSnapshot();
22+
});
1623
});

0 commit comments

Comments
 (0)