-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
await using
from Babel
- Loading branch information
1 parent
d2c2d1e
commit 793a6e6
Showing
14 changed files
with
732 additions
and
0 deletions.
There are no files selected for viewing
631 changes: 631 additions & 0 deletions
631
tests/format/js/explicit-resource-management/__snapshots__/jsfmt.spec.js.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/format/js/explicit-resource-management/valid-await-expr-using-in.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using in foo; | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/format/js/explicit-resource-management/valid-await-expr-using-instanceof.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using instanceof foo; | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/format/js/explicit-resource-management/valid-await-expr-using.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
async function f() { | ||
await using[x]; | ||
await using.x + await using(x) ? await using?.x : await using`x`; | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/format/js/explicit-resource-management/valid-await-using-asi-assignment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
async function f() { | ||
await using | ||
using = h(); | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/format/js/explicit-resource-management/valid-await-using-binding-basic.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using basic = getReader(); | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/format/js/explicit-resource-management/valid-await-using-binding-escaped.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using \u0061b = c; | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/format/js/explicit-resource-management/valid-await-using-binding-non-bmp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
await using 𠮷 = foo(); | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/format/js/explicit-resource-management/valid-await-using-binding-using.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
async function f() { | ||
await using using = of; | ||
for (await using using of of); | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/format/js/explicit-resource-management/valid-await-using-comments.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
async function f() { | ||
{ | ||
/*0*/await/*1*/using/*2*/b/*3*/=/*4*/f()/*5*/; | ||
} | ||
{ | ||
/*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; | ||
} | ||
{ | ||
/*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/; | ||
} | ||
{ | ||
/*0*/for/*1*/await/*2*/(/*3*/await/*4*/using/*5*/b/*6*/of/*7*/x/*8*/)/*9*/; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/format/js/explicit-resource-management/valid-for-using-binding-of-of.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
async function f() { | ||
for (await using of of of); | ||
for await (await using of of of); | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/format/js/explicit-resource-management/valid-for-using-declaration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
async function f() { | ||
for (await using basic = reader();;); | ||
} |
3 changes: 3 additions & 0 deletions
3
...ormat/js/explicit-resource-management/valid-module-block-top-level-await-using-binding.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const m = module { | ||
await using foo = bar(); | ||
} |