mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibJS: Parse generator functions in object literals
Also add some parser tests
This commit is contained in:
parent
2661a88108
commit
d374295a26
3 changed files with 34 additions and 5 deletions
|
@ -21,3 +21,21 @@ describe("parsing freestanding generators", () => {
|
|||
*bar; }`).toEval();
|
||||
});
|
||||
});
|
||||
|
||||
describe("parsing object literal generator functions", () => {
|
||||
test("simple", () => {
|
||||
expect(`x = { *foo() { } }`).toEval();
|
||||
expect(`x = { * foo() { } }`).toEval();
|
||||
expect(`x = { *
|
||||
foo() { } }`).toEval();
|
||||
});
|
||||
test("yield", () => {
|
||||
expect(`x = { foo() { yield; } }`).toEval();
|
||||
expect(`x = { *foo() { yield; } }`).toEval();
|
||||
expect(`x = { *foo() { yield 42; } }`).toEval();
|
||||
expect(`x = { foo() { yield 42; } }`).not.toEval();
|
||||
expect(`x = { *foo() { yield (yield); } }`).toEval();
|
||||
expect(`x = { *
|
||||
foo() { yield (yield); } }`).toEval();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue