From ba5642d4ee33dad7c66051613a85884bbc639736 Mon Sep 17 00:00:00 2001 From: James DiGioia Date: Thu, 9 Aug 2018 22:08:39 -0400 Subject: [PATCH] Add test for computer properties This seems to parse fine. Should it? --- .../input.js | 1 + .../options.json | 3 + .../output.json | 148 ++++++++++++++++++ 3 files changed, 152 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/input.js new file mode 100644 index 0000000000..5a02dee8ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/input.js @@ -0,0 +1 @@ +value |> a[b] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/options.json new file mode 100644 index 0000000000..17e4e327bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "smart" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/output.json new file mode 100644 index 0000000000..540ce0ba40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-bare-style,-function-calls,-single,-computed/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "callee": { + "type": "MemberExpression", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": true + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file