From 216ed0aad229e57dacdc6c17c858ac062e50c21a Mon Sep 17 00:00:00 2001 From: sosukesuzuki Date: Sat, 4 Sep 2021 20:47:00 +0900 Subject: [PATCH] Add tests for static blocks with line breaks --- .../input.ts | 6 +++ .../output.json | 49 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/output.json diff --git a/packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/input.ts b/packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/input.ts new file mode 100644 index 000000000000..6a074f44801a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/input.ts @@ -0,0 +1,6 @@ +class Foo { + static + { + something(); + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/output.json b/packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/output.json new file mode 100644 index 000000000000..caf950e6e3fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/static-blocks/valid-static-block-with-line-breaks/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":10,"end":47,"loc":{"start":{"line":1,"column":10},"end":{"line":6,"column":1}}, + "body": [ + { + "type": "StaticBlock", + "start":14,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":29,"end":41,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":16}}, + "expression": { + "type": "CallExpression", + "start":29,"end":40,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}}, + "callee": { + "type": "Identifier", + "start":29,"end":38,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":13},"identifierName":"something"}, + "name": "something" + }, + "arguments": [] + } + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file