Enable using tests for hermes parser (#18961)
This commit is contained in:
1 parent
3ff4e67403
commit
906406f7ea
3 files changed
+142
-6
No files matched your search
@@ -96,9 +96,6 @@ const disabledTests = new Map(
|
||||
|
||||
// Different result
|
||||
"flow/hook/comments-before-arrow.js",
|
||||
|
||||
// Bug
|
||||
"js/explicit-resource-management/",
|
||||
],
|
||||
flow: [
|
||||
// Parsing to different ASTs
|
||||
|
||||
@@ -20,6 +20,16 @@ exports[`for-await-using-of-comments.js format[flow] 1`] = `
|
||||
2 |"
|
||||
`;
|
||||
|
||||
exports[`for-await-using-of-comments.js format[hermes] 1`] = `
|
||||
"'(' expected after 'for' (1:18)
|
||||
> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/;
|
||||
| ^
|
||||
2 |
|
||||
Cause: '(' expected after 'for' (1:18)
|
||||
/*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/;
|
||||
~~~~~~~~~~~~^"
|
||||
`;
|
||||
|
||||
exports[`for-await-using-of-comments.js format[meriyah] 1`] = `
|
||||
"for await (... of ...) is only valid in async functions and async generators (1:51)
|
||||
> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/;
|
||||
@@ -86,6 +96,22 @@ exports[`invalid-duplicate-using-bindings.js format[flow] 1`] = `
|
||||
5 | using g = foo();"
|
||||
`;
|
||||
|
||||
exports[`invalid-duplicate-using-bindings.js format[hermes] 1`] = `
|
||||
"Identifier 'f' is already declared (2:19)
|
||||
1 | {
|
||||
> 2 | using f = foo(), f = foo();
|
||||
| ^
|
||||
3 | }
|
||||
4 | {
|
||||
5 | using g = foo();
|
||||
Cause: Identifier 'f' is already declared (2:19)
|
||||
using f = foo(), f = foo();
|
||||
^
|
||||
note: previous declaration (2:8)
|
||||
using f = foo(), f = foo();
|
||||
^"
|
||||
`;
|
||||
|
||||
exports[`invalid-duplicate-using-bindings.js format[meriyah] 1`] = `
|
||||
"Unexpected token: 'identifier' (2:9)
|
||||
1 | {
|
||||
@@ -161,6 +187,20 @@ exports[`using-declarations.js format[flow] 1`] = `
|
||||
5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);"
|
||||
`;
|
||||
|
||||
exports[`using-declarations.js format[hermes] 1`] = `
|
||||
"';' or 'in' expected inside 'for' (5:20)
|
||||
3 | }
|
||||
4 |
|
||||
> 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);
|
||||
| ^
|
||||
6 |
|
||||
7 | for(using /* 1 */ foo of bar());
|
||||
8 |
|
||||
Cause: ';' or 'in' expected inside 'for' (5:20)
|
||||
for(using /* 1 */ a = foo(), /* 2 */ b = foo();;);
|
||||
~~~~~~~~~~~~~~~~~~~~^"
|
||||
`;
|
||||
|
||||
exports[`using-declarations.js format[meriyah] 1`] = `
|
||||
"Unexpected token: 'identifier' (2:17)
|
||||
1 | {
|
||||
@@ -208,6 +248,18 @@ async function f() {
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`valid-await-expr-using-in.js format[hermes] 1`] = `
|
||||
"'identifier' expected in declaration (2:14)
|
||||
1 | async function f() {
|
||||
> 2 | await using in foo;
|
||||
| ^
|
||||
3 | }
|
||||
4 |
|
||||
Cause: 'identifier' expected in declaration (2:14)
|
||||
await using in foo;
|
||||
~~~~~~~~~~~~^"
|
||||
`;
|
||||
|
||||
exports[`valid-await-expr-using-instanceof.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
@@ -225,6 +277,18 @@ async function f() {
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`valid-await-expr-using-instanceof.js format[hermes] 1`] = `
|
||||
"'identifier' expected in declaration (2:14)
|
||||
1 | async function f() {
|
||||
> 2 | await using instanceof foo;
|
||||
| ^
|
||||
3 | }
|
||||
4 |
|
||||
Cause: 'identifier' expected in declaration (2:14)
|
||||
await using instanceof foo;
|
||||
~~~~~~~~~~~~^"
|
||||
`;
|
||||
|
||||
exports[`valid-await-using-asi-assignment.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
@@ -445,6 +509,20 @@ exports[`valid-await-using-comments.js format[flow] 1`] = `
|
||||
6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/;"
|
||||
`;
|
||||
|
||||
exports[`valid-await-using-comments.js format[hermes] 1`] = `
|
||||
"';' or 'in' expected inside 'for' (6:47)
|
||||
4 | }
|
||||
5 | {
|
||||
> 6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/;
|
||||
| ^
|
||||
7 | }
|
||||
8 | {
|
||||
9 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/of/*6*/x/*7*/)/*8*/;
|
||||
Cause: ';' or 'in' expected inside 'for' (6:47)
|
||||
/*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^"
|
||||
`;
|
||||
|
||||
exports[`valid-await-using-comments.js format[meriyah] 1`] = `
|
||||
"Unexpected token: 'identifier' (3:28)
|
||||
1 | async function f() {
|
||||
@@ -575,6 +653,18 @@ exports[`valid-for-using-declaration.js format[flow] 1`] = `
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`valid-for-using-declaration.js format[hermes] 1`] = `
|
||||
"';' or 'in' expected inside 'for' (2:25)
|
||||
1 | async function f() {
|
||||
> 2 | for (await using basic = reader();;);
|
||||
| ^
|
||||
3 | }
|
||||
4 |
|
||||
Cause: ';' or 'in' expected inside 'for' (2:25)
|
||||
for (await using basic = reader();;);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~^"
|
||||
`;
|
||||
|
||||
exports[`valid-for-using-declaration.js format[meriyah] 1`] = `
|
||||
"Expected ';' (2:20)
|
||||
1 | async function f() {
|
||||
@@ -631,6 +721,18 @@ exports[`valid-module-block-top-level-await-using-binding.js format[flow] 1`] =
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`valid-module-block-top-level-await-using-binding.js format[hermes] 1`] = `
|
||||
"';' expected (1:17)
|
||||
> 1 | const m = module {
|
||||
| ^
|
||||
2 | await using foo = bar();
|
||||
3 | }
|
||||
4 |
|
||||
Cause: ';' expected (1:17)
|
||||
const m = module {
|
||||
^"
|
||||
`;
|
||||
|
||||
exports[`valid-module-block-top-level-await-using-binding.js format[meriyah] 1`] = `
|
||||
"Unexpected token: '{' (1:18)
|
||||
> 1 | const m = module {
|
||||
@@ -715,6 +817,18 @@ exports[`valid-module-block-top-level-using-binding.js format[flow] 1`] = `
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`valid-module-block-top-level-using-binding.js format[hermes] 1`] = `
|
||||
"';' expected (1:7)
|
||||
> 1 | module {
|
||||
| ^
|
||||
2 | using foo = bar();
|
||||
3 | }
|
||||
4 |
|
||||
Cause: ';' expected (1:7)
|
||||
module {
|
||||
^"
|
||||
`;
|
||||
|
||||
exports[`valid-module-block-top-level-using-binding.js format[meriyah] 1`] = `
|
||||
"Unexpected token: '{' (1:8)
|
||||
> 1 | module {
|
||||
@@ -803,6 +917,16 @@ exports[`valid-using-as-identifier-for-await-of.js format[flow] 1`] = `
|
||||
2 |"
|
||||
`;
|
||||
|
||||
exports[`valid-using-as-identifier-for-await-of.js format[hermes] 1`] = `
|
||||
"'(' expected after 'for' (1:4)
|
||||
> 1 | for await (using of of);
|
||||
| ^
|
||||
2 |
|
||||
Cause: '(' expected after 'for' (1:4)
|
||||
for await (using of of);
|
||||
~~~~^"
|
||||
`;
|
||||
|
||||
exports[`valid-using-as-identifier-for-in.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
@@ -822,6 +946,14 @@ for (using\`\`.foo in []);
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`valid-using-as-identifier-for-in.js format[hermes] 1`] = `
|
||||
"Failed to parse source (0:0)
|
||||
1 | for (using in []);
|
||||
2 | for (using.foo in []);
|
||||
3 | for (using().foo in []);
|
||||
Cause: Failed to parse source"
|
||||
`;
|
||||
|
||||
exports[`valid-using-as-identifier-for-init.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
@@ -869,6 +1001,16 @@ using in using instanceof using;
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`valid-using-as-identifier-in.js format[hermes] 1`] = `
|
||||
"'identifier' expected in declaration (1:6)
|
||||
> 1 | using in using instanceof using;
|
||||
| ^
|
||||
2 |
|
||||
Cause: 'identifier' expected in declaration (1:6)
|
||||
using in using instanceof using;
|
||||
~~~~~~^"
|
||||
`;
|
||||
|
||||
exports[`valid-using-binding-basic.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "flow", "typescript"]
|
||||
|
||||
@@ -32,12 +32,9 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], {
|
||||
// "valid-for-using-binding-escaped-of-of.js",
|
||||
"valid-module-block-top-level-using-binding.js",
|
||||
"valid-using-as-identifier-for-await-of.js",
|
||||
"valid-using-binding-using.js",
|
||||
|
||||
"valid-await-using-binding-using.js",
|
||||
"valid-await-using-comments.js",
|
||||
"valid-for-lhs-await-as-identifier.js",
|
||||
"valid-for-using-binding-of-of.js",
|
||||
"valid-for-using-declaration.js",
|
||||
"valid-module-block-top-level-await-using-binding.js",
|
||||
"valid-using-as-identifier-in.js",
|
||||
|
||||
Reference in new issue
Block a user