mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-17 07:50:04 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
65
Libraries/LibJS/Tests/syntax/generators.js
Normal file
65
Libraries/LibJS/Tests/syntax/generators.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
describe("parsing freestanding generators", () => {
|
||||
test("simple", () => {
|
||||
expect(`function* foo() {}`).toEval();
|
||||
expect(`function *foo() {}`).toEval();
|
||||
expect(`function
|
||||
*foo() {}`).toEval();
|
||||
|
||||
expect(`function *await() {}`).toEval();
|
||||
expect(`function *yield() {}`).toEval();
|
||||
});
|
||||
test("yield expression", () => {
|
||||
expect(`function* foo() { yield; }`).toEval();
|
||||
expect(`function* foo() { yield (yield); }`).toEval();
|
||||
expect(`function* foo() { yield (yield foo); }`).toEval();
|
||||
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();
|
||||
expect(`function* foo() { yield
|
||||
*bar; }`).not.toEval();
|
||||
expect(`function foo() { yield
|
||||
*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();
|
||||
});
|
||||
});
|
||||
|
||||
describe("parsing classes with generator methods", () => {
|
||||
test("simple", () => {
|
||||
expect(`class Foo { *foo() {} }`).toEval();
|
||||
expect(`class Foo { static *foo() {} }`).toEval();
|
||||
expect(`class Foo { *foo() { yield; } }`).toEval();
|
||||
expect(`class Foo { *foo() { yield 42; } }`).toEval();
|
||||
expect(`class Foo { *constructor() { yield 42; } }`).not.toEval();
|
||||
});
|
||||
});
|
||||
|
||||
test("function expression names equal to 'yield'", () => {
|
||||
expect(`function *foo() { (function yield() {}); }`).toEval();
|
||||
expect(`function *foo() { function yield() {} }`).not.toEval();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue