From 696f84468e1ec2fd68a1f4b2fde34373012526ea Mon Sep 17 00:00:00 2001 From: James DiGioia Date: Thu, 26 Apr 2018 18:21:56 -0400 Subject: [PATCH] Add test for params w/ parens around them --- .../with-arrow-parend-params/input.js | 1 + .../with-arrow-parend-params/options.json | 3 + .../with-arrow-parend-params/output.json | 179 ++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/input.js create mode 100644 packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/options.json create mode 100644 packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/output.json diff --git a/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/input.js b/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/input.js new file mode 100644 index 0000000000..dc21d546eb --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/input.js @@ -0,0 +1 @@ +10 |> ((x) => x + 1); diff --git a/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/options.json b/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/options.json new file mode 100644 index 0000000000..599d48a469 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["pipelineOperator"] +} diff --git a/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/output.json b/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/output.json new file mode 100644 index 0000000000..59844656d5 --- /dev/null +++ b/packages/babylon/test/fixtures/experimental/pipeline-operator/with-arrow-parend-params/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "ArrowFunctionExpression", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BinaryExpression", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "left": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file