mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
14 lines
524 B
JavaScript
14 lines
524 B
JavaScript
test("for-of RHS must be AssignmentExpression, not comma expression", () => {
|
|
expect("for (var x of 1, 2) {}").not.toEval();
|
|
expect("for (let x of 1, 2) {}").not.toEval();
|
|
expect("for (const x of 1, 2) {}").not.toEval();
|
|
expect("for (x of 1, 2) {}").not.toEval();
|
|
|
|
// Valid: parenthesized comma expression is fine (it's a single AssignmentExpression)
|
|
expect("for (var x of (1, 2)) {}").toEval();
|
|
});
|
|
|
|
test("for-of may not start with let", () => {
|
|
expect("for (let.x of []) {}").not.toEval();
|
|
});
|