Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Apr 12, 2021
1 parent b4eadb6 commit 7ec0b1d
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 0 deletions.
109 changes: 109 additions & 0 deletions tests/misc/errors/js/for-of/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,109 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`snippet: #0 [babel] format 1`] = `
"Unexpected reserved word 'let' (1:6)
> 1 | for (let.foo of []);
| ^"
`;

exports[`snippet: #0 [babel-flow] format 1`] = `
"Unexpected reserved word 'let' (1:6)
> 1 | for (let.foo of []);
| ^"
`;

exports[`snippet: #0 [babel-ts] format 1`] = `
"The left-hand side of a for-of loop may not start with 'let'. (1:6)
> 1 | for (let.foo of []);
| ^"
`;

exports[`snippet: #0 [flow] format 1`] = `
"Unexpected token \`.\`, expected an identifier (1:9)
> 1 | for (let.foo of []);
| ^"
`;

exports[`snippet: #0 [meriyah] format 1`] = `
"[1:9]: Identifier \\"let\\" disallowed as left-hand side expression in strict mode (1:9)
> 1 | for (let.foo of []);
| ^"
`;

exports[`snippet: #0 [typescript] format 1`] = `
"Variable declaration expected. (1:9)
> 1 | for (let.foo of []);
| ^"
`;

exports[`snippet: #1 [babel] format 1`] = `
"Unexpected reserved word 'let' (1:6)
> 1 | for (let().bar of []);
| ^"
`;

exports[`snippet: #1 [babel-flow] format 1`] = `
"Unexpected reserved word 'let' (1:6)
> 1 | for (let().bar of []);
| ^"
`;

exports[`snippet: #1 [babel-ts] format 1`] = `
"The left-hand side of a for-of loop may not start with 'let'. (1:6)
> 1 | for (let().bar of []);
| ^"
`;

exports[`snippet: #1 [flow] format 1`] = `
"Unexpected token \`(\`, expected an identifier (1:9)
> 1 | for (let().bar of []);
| ^"
`;

exports[`snippet: #1 [meriyah] format 1`] = `
"[1:9]: Identifier \\"let\\" disallowed as left-hand side expression in strict mode (1:9)
> 1 | for (let().bar of []);
| ^"
`;

exports[`snippet: #1 [typescript] format 1`] = `
"Variable declaration expected. (1:9)
> 1 | for (let().bar of []);
| ^"
`;

exports[`snippet: #2 [babel] format 1`] = `
"Unexpected reserved word 'let' (1:6)
> 1 | for (let\`\`.bar of []);
| ^"
`;

exports[`snippet: #2 [babel-flow] format 1`] = `
"Unexpected reserved word 'let' (1:6)
> 1 | for (let\`\`.bar of []);
| ^"
`;

exports[`snippet: #2 [babel-ts] format 1`] = `
"The left-hand side of a for-of loop may not start with 'let'. (1:6)
> 1 | for (let\`\`.bar of []);
| ^"
`;

exports[`snippet: #2 [flow] format 1`] = `
"Unexpected template literal part, expected an identifier (1:9)
> 1 | for (let\`\`.bar of []);
| ^^"
`;

exports[`snippet: #2 [meriyah] format 1`] = `
"[1:10]: Identifier \\"let\\" disallowed as left-hand side expression in strict mode (1:10)
> 1 | for (let\`\`.bar of []);
| ^"
`;

exports[`snippet: #2 [typescript] format 1`] = `
"Variable declaration expected. (1:9)
> 1 | for (let\`\`.bar of []);
| ^"
`;
20 changes: 20 additions & 0 deletions tests/misc/errors/js/for-of/jsfmt.spec.js
@@ -0,0 +1,20 @@
run_spec(
{
dirname: __dirname,
snippets: [
"for (let.foo of []);",
"for (let().bar of []);",
"for (let``.bar of []);",
],
},
[
"babel",
// Espree didn't throw https://github.com/acornjs/acorn/issues/1009
// "espree",
"meriyah",
"flow",
"typescript",
"babel-flow",
"babel-ts",
]
);

0 comments on commit 7ec0b1d

Please sign in to comment.