Skip to content

Commit

Permalink
chore: add test for nested blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloricciuti committed May 10, 2024
1 parent a39e111 commit 2be5f09
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/tests/expected-transforms/statements-in-blocks/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,16 @@ task(async ()=>{
if(await Promise.resolve(true)){
console.log(await Promise.resolve());
}else console.log(await Promise.resolve());

// nested test
for(const x of await Promise.resolve([])){
console.log(await Promise.resolve("for of"));
while(await Promise.resolve(true)){
console.log(await Promise.resolve("while"));
for(const xx in await Promise.resolve({})){
console.log(await Promise.resolve("for in"));

}
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,16 @@ task(async function* () {
if (yield Promise.resolve(true)) {
console.log(yield Promise.resolve());
} else console.log(yield Promise.resolve());

for (const x of yield Promise.resolve([])) {
console.log(yield Promise.resolve("for of"));

while (yield Promise.resolve(true)) {
console.log(yield Promise.resolve("while"));

for (const xx in yield Promise.resolve({})) {
console.log(yield Promise.resolve("for in"));
}
}
}
});

0 comments on commit 2be5f09

Please sign in to comment.