Skip to content

Commit c3ed2d3

Browse files
committed
Change Parser unit test to be compatible with node < 10
1 parent 4e15f64 commit c3ed2d3

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

test/Parser.unittest.js

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -159,26 +159,6 @@ describe("Parser", () => {
159159
fgh: ["test", "test ttt", "test e"]
160160
}
161161
],
162-
"in try, no binding": [
163-
function() {
164-
try {
165-
fgh.sub;
166-
fgh;
167-
168-
function test(ttt) {
169-
fgh.sub;
170-
fgh;
171-
}
172-
} catch {
173-
fgh.sub;
174-
fgh;
175-
}
176-
},
177-
{
178-
fghsub: ["try", "notry", "notry"],
179-
fgh: ["test", "test ttt", "test"]
180-
}
181-
],
182162
"renaming with const": [
183163
function() {
184164
const xyz = abc;
@@ -638,4 +618,19 @@ describe("Parser", () => {
638618
});
639619
});
640620
});
621+
622+
describe("optional catch binding support", () => {
623+
describe("should accept", () => {
624+
const cases = {
625+
"optional binding": "try {} catch {}"
626+
};
627+
Object.keys(cases).forEach(name => {
628+
const expr = cases[name];
629+
it(name, () => {
630+
const actual = Parser.parse(expr);
631+
expect(typeof actual).toBe("object");
632+
});
633+
});
634+
});
635+
});
641636
});

0 commit comments

Comments
 (0)