LibJS: Multiple 'default' clauses in switch statement are a syntax error

This commit is contained in:
Linus Groh
2020-10-18 23:12:27 +01:00
committed by Andreas Kling
parent 57e7b2f8e4
commit 2dbea60fe2
Notes: sideshowbarker 2024-07-19 01:50:55 +09:00
2 changed files with 16 additions and 1 deletions

View File

@@ -68,3 +68,11 @@ describe("basic switch tests", () => {
expect(i).toBe(5);
});
});
describe("errors", () => {
test("syntax errors", () => {
expect("switch () {}").not.toEval();
expect("switch (foo) { bar }").not.toEval();
expect("switch (foo) { default: default: }").not.toEval();
});
});