mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 15:28:55 +00:00
'continue' is no longer allowed outside of a loop, and an unlabeled 'break' is not longer allowed outside of a loop or switch statement. Labeled 'break' statements are still allowed everywhere, even if the label does not exist.
18 lines
645 B
JavaScript
18 lines
645 B
JavaScript
test("'break' syntax errors", () => {
|
|
expect("break").not.toEval();
|
|
expect("break label").not.toEval();
|
|
expect("{ break }").not.toEval();
|
|
// FIXME: Parser does not throw error on nonexistent label
|
|
// expect("{ break label }.not.toEval();
|
|
expect("label: { break label }").toEval();
|
|
});
|
|
|
|
test("'continue' syntax errors", () => {
|
|
expect("continue").not.toEval();
|
|
expect("continue label").not.toEval();
|
|
expect("{ continue }").not.toEval();
|
|
expect("{ continue label }").not.toEval();
|
|
expect("label: { continue label }").not.toEval();
|
|
|
|
expect("switch (true) { case true: continue; }").not.toEval();
|
|
});
|