From a151388a9486af0698cc5d6e0ae879e272df1c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 13 Jan 2022 10:25:12 -0500 Subject: [PATCH] add more testcases --- .../after-bit-shift/input.ts | 1 + .../after-bit-shift/output.json | 49 ++++++++++++++ .../type-arguments-like/input.ts | 1 + .../type-arguments-like/output.json | 64 +++++++++++++++++++ .../after-bit-shift/input.ts | 1 + .../after-bit-shift/output.json | 49 ++++++++++++++ .../type-arguments-like/input.ts | 1 + .../type-arguments-like/output.json | 64 +++++++++++++++++++ 8 files changed, 230 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/output.json diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/input.ts b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/input.ts new file mode 100644 index 000000000000..22101bcfd01d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/input.ts @@ -0,0 +1 @@ +f<<(x) diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/output.json new file mode 100644 index 000000000000..140ef3375bdd --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/after-bit-shift/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, + "name": "f" + }, + "operator": "<<", + "right": { + "type": "TSTypeAssertion", + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "typeName": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"T"}, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, + "name": "x", + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/input.ts b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/input.ts new file mode 100644 index 000000000000..7e2a54ba7ab5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/input.ts @@ -0,0 +1 @@ +f<< T > (()=>T) > T diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/output.json new file mode 100644 index 000000000000..127d0690fc75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like-babel-7/type-arguments-like/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "left": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "left": { + "type": "BinaryExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, + "name": "f" + }, + "operator": "<<", + "right": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"T"}, + "name": "T" + } + }, + "operator": ">", + "right": { + "type": "ArrowFunctionExpression", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, + "name": "T" + }, + "extra": { + "parenthesized": true, + "parenStart": 8 + } + } + }, + "operator": ">", + "right": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"}, + "name": "T" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/input.ts b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/input.ts new file mode 100644 index 000000000000..22101bcfd01d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/input.ts @@ -0,0 +1 @@ +f<<(x) diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/output.json new file mode 100644 index 000000000000..140ef3375bdd --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/after-bit-shift/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, + "name": "f" + }, + "operator": "<<", + "right": { + "type": "TSTypeAssertion", + "start":3,"end":9,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":9}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "typeName": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"T"}, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"x"}, + "name": "x", + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/input.ts b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/input.ts new file mode 100644 index 000000000000..7e2a54ba7ab5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/input.ts @@ -0,0 +1 @@ +f<< T > (()=>T) > T diff --git a/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/output.json b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/output.json new file mode 100644 index 000000000000..127d0690fc75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/type-arguments-bit-shift-left-like/type-arguments-like/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "program": { + "type": "Program", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "left": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "left": { + "type": "BinaryExpression", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"f"}, + "name": "f" + }, + "operator": "<<", + "right": { + "type": "Identifier", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"T"}, + "name": "T" + } + }, + "operator": ">", + "right": { + "type": "ArrowFunctionExpression", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"}, + "name": "T" + }, + "extra": { + "parenthesized": true, + "parenStart": 8 + } + } + }, + "operator": ">", + "right": { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"}, + "name": "T" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file