mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-22 02:49:29 +03:00
LibJS: Add a test file for generator function parsing
Note that the yield-from expression tests are skipped for now since they're not implemented yet.
This commit is contained in:
parent
5bfe601152
commit
2661a88108
Notes:
sideshowbarker
2024-07-18 12:15:09 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/2661a881089 Pull-request: https://github.com/SerenityOS/serenity/pull/8050 Reviewed-by: https://github.com/linusg
23
Userland/Libraries/LibJS/Tests/syntax/generators.js
Normal file
23
Userland/Libraries/LibJS/Tests/syntax/generators.js
Normal file
@ -0,0 +1,23 @@
|
||||
describe("parsing freestanding generators", () => {
|
||||
test("simple", () => {
|
||||
expect(`function* foo() {}`).toEval();
|
||||
expect(`function *foo() {}`).toEval();
|
||||
expect(`function
|
||||
*foo() {}`).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.skip("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();
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user