summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/syntax/generators.js
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/syntax/generators.js')
-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();