summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authordavidot <davidot@serenityos.org>2021-11-26 23:38:36 +0100
committerLinus Groh <mail@linusgroh.de>2021-11-30 17:05:32 +0000
commit4d7e79fb72c33bf341688428948c3c8e90898960 (patch)
treeed4de356490d03b98f8861566ef54430c571f957 /Userland/Libraries/LibJS/Tests
parent156dfe3d629f36a03bdcde3a9a253934e45dd4de (diff)
downloadserenity-4d7e79fb72c33bf341688428948c3c8e90898960.zip
LibJS: Stop parsing an expression on comma after a yield
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/syntax/generators.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/syntax/generators.js b/Userland/Libraries/LibJS/Tests/syntax/generators.js
index 99e0968c4b..c70bc6cf72 100644
--- a/Userland/Libraries/LibJS/Tests/syntax/generators.js
+++ b/Userland/Libraries/LibJS/Tests/syntax/generators.js
@@ -12,6 +12,12 @@ describe("parsing freestanding generators", () => {
expect(`function foo() { yield; }`).toEval();
expect(`function foo() { yield 3; }`).not.toEval();
});
+
+ test("yield expression only gets the first expression", () => {
+ expect("function* foo() { yield 2,3 }").toEval();
+ expect("function* foo() { ({...yield yield, }) }").toEval();
+ });
+
test("yield-from expression", () => {
expect(`function* foo() { yield *bar; }`).toEval();
expect(`function* foo() { yield *(yield); }`).toEval();