Skip to content

Commit

Permalink
Add test for babel/babel#13099
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Apr 12, 2021
1 parent cafe0f7 commit b4eadb6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
Expand Up @@ -15,3 +15,21 @@ exports[`classAbstractMethodWithImplementation.ts [babel-ts] format 1`] = `
| ^
3 | }"
`;

exports[`snippet: #0 [babel-ts] format 1`] = `
"Invalid left-hand side in assignment expression (1:1)
> 1 | foo as any = 10;
| ^"
`;

exports[`snippet: #1 [babel-ts] format 1`] = `
"Invalid left-hand side in assignment expression (1:7)
> 1 | ({ a: b as any = 2000 } = x);
| ^"
`;

exports[`snippet: #2 [babel-ts] format 1`] = `
"Unterminated JSX contents (1:9)
> 1 | <string>foo = '100';
| ^"
`;
12 changes: 11 additions & 1 deletion tests/misc/errors/typescript/babel-ts/jsfmt.spec.js
@@ -1 +1,11 @@
run_spec(__dirname, ["babel-ts"]);
run_spec(
{
dirname: __dirname,
snippets: [
"foo as any = 10;",
"({ a: b as any = 2000 } = x);",
"<string>foo = '100';",
],
},
["babel-ts"]
);
15 changes: 15 additions & 0 deletions tests/typescript/cast/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -22,6 +22,21 @@ let x = "123" as const;
================================================================================
`;

exports[`assert-and-assign.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
(a as number) = 42;
({ a: (b as any) = 2000 } = x);
=====================================output=====================================
(a as number) = 42;
({ a: b as any = 2000 } = x);
================================================================================
`;

exports[`generic-cast.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
Expand Down
2 changes: 2 additions & 0 deletions tests/typescript/cast/assert-and-assign.ts
@@ -0,0 +1,2 @@
(a as number) = 42;
({ a: (b as any) = 2000 } = x);

0 comments on commit b4eadb6

Please sign in to comment.