Skip to content

Commit 7f99d0d

Browse files
author
Kristijan Novaković
committed
Added test for multiple catch without variable
1 parent e5dbdb0 commit 7f99d0d

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

test/snapshot/__snapshots__/try.test.js.snap

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,71 @@ Program {
361361
}
362362
`;
363363

364+
exports[`boolean multiple catch without variable 1`] = `
365+
Program {
366+
"children": Array [
367+
Try {
368+
"always": null,
369+
"body": Block {
370+
"children": Array [
371+
ExpressionStatement {
372+
"expression": Call {
373+
"arguments": Array [],
374+
"kind": "call",
375+
"what": Name {
376+
"kind": "name",
377+
"name": "call",
378+
"resolution": "uqn",
379+
},
380+
},
381+
"kind": "expressionstatement",
382+
},
383+
],
384+
"kind": "block",
385+
},
386+
"catches": Array [
387+
Catch {
388+
"body": Block {
389+
"children": Array [
390+
ExpressionStatement {
391+
"expression": Call {
392+
"arguments": Array [],
393+
"kind": "call",
394+
"what": Name {
395+
"kind": "name",
396+
"name": "do_something",
397+
"resolution": "uqn",
398+
},
399+
},
400+
"kind": "expressionstatement",
401+
},
402+
],
403+
"kind": "block",
404+
},
405+
"kind": "catch",
406+
"variable": null,
407+
"what": Array [
408+
Name {
409+
"kind": "name",
410+
"name": "MyException",
411+
"resolution": "uqn",
412+
},
413+
Name {
414+
"kind": "name",
415+
"name": "MyOtherException",
416+
"resolution": "uqn",
417+
},
418+
],
419+
},
420+
],
421+
"kind": "try",
422+
},
423+
],
424+
"errors": Array [],
425+
"kind": "program",
426+
}
427+
`;
428+
364429
exports[`boolean qualified name 1`] = `
365430
Program {
366431
"children": Array [

test/snapshot/try.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ describe("boolean", () => {
5656
)
5757
).toMatchSnapshot();
5858
});
59+
it("multiple catch without variable", () => {
60+
expect(
61+
parser.parseEval(
62+
"try { call(); } catch (MyException | MyOtherException) { do_something(); }"
63+
)
64+
).toMatchSnapshot();
65+
});
5966
it("multiple catch #2", () => {
6067
expect(
6168
parser.parseEval(

0 commit comments

Comments
 (0)