From 12d5126e32c10128c131c4c92c83cf28b123f74d Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 22 Sep 2019 14:10:19 -0400 Subject: [PATCH] update tests. one still failing --- .../samples/action-with-call/output.json | 30 ++ .../samples/action-with-literal/output.json | 10 + test/parser/samples/animation/output.json | 20 ++ .../samples/await-then-catch/output.json | 50 ++++ .../samples/binding-shorthand/output.json | 40 +++ test/parser/samples/binding/output.json | 40 +++ .../samples/component-dynamic/output.json | 40 +++ .../parser/samples/dynamic-import/output.json | 280 ++++++++++++++++++ .../each-block-destructured/output.json | 10 + .../samples/each-block-else/output.json | 10 + .../samples/each-block-indexed/output.json | 10 + .../samples/each-block-keyed/output.json | 40 +++ test/parser/samples/each-block/output.json | 10 + test/parser/samples/event-handler/output.json | 50 ++++ .../samples/if-block-elseif/output.json | 60 ++++ test/parser/samples/raw-mustaches/output.json | 20 ++ test/parser/samples/refs/output.json | 40 +++ .../samples/script-comment-only/output.json | 10 + .../output.json | 50 ++++ .../script-comment-trailing/output.json | 50 ++++ test/parser/samples/script/output.json | 50 ++++ .../parser/samples/self-reference/output.json | 60 ++++ .../samples/transition-intro/output.json | 40 +++ .../samples/unusual-identifier/output.json | 20 ++ test/sourcemaps/index.js | 2 +- 25 files changed, 1041 insertions(+), 1 deletion(-) diff --git a/test/parser/samples/action-with-call/output.json b/test/parser/samples/action-with-call/output.json index e910f0b49f..ccb4011c67 100644 --- a/test/parser/samples/action-with-call/output.json +++ b/test/parser/samples/action-with-call/output.json @@ -20,10 +20,30 @@ "type": "CallExpression", "start": 21, "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, "callee": { "type": "Identifier", "start": 21, "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, "name": "t" }, "arguments": [ @@ -31,6 +51,16 @@ "type": "Literal", "start": 23, "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, "value": "tooltip msg", "raw": "'tooltip msg'" } diff --git a/test/parser/samples/action-with-literal/output.json b/test/parser/samples/action-with-literal/output.json index 01a6b67549..bb0b13ee42 100644 --- a/test/parser/samples/action-with-literal/output.json +++ b/test/parser/samples/action-with-literal/output.json @@ -20,6 +20,16 @@ "type": "Literal", "start": 21, "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, "value": "tooltip msg", "raw": "'tooltip msg'" } diff --git a/test/parser/samples/animation/output.json b/test/parser/samples/animation/output.json index f4d183eb5c..1958ba2817 100644 --- a/test/parser/samples/animation/output.json +++ b/test/parser/samples/animation/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 7, "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, "name": "things" }, "children": [ @@ -51,6 +61,16 @@ "type": "Identifier", "start": 24, "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, "name": "thing" } } diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json index ac598a403a..d9defb6932 100644 --- a/test/parser/samples/await-then-catch/output.json +++ b/test/parser/samples/await-then-catch/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 8, "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, "name": "thePromise" }, "value": "theValue", @@ -88,6 +98,16 @@ "type": "Identifier", "start": 74, "end": 82, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 26 + } + }, "name": "theValue" } } @@ -137,16 +157,46 @@ "type": "MemberExpression", "start": 118, "end": 134, + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 28 + } + }, "object": { "type": "Identifier", "start": 118, "end": 126, + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 20 + } + }, "name": "theError" }, "property": { "type": "Identifier", "start": 127, "end": 134, + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 28 + } + }, "name": "message" }, "computed": false diff --git a/test/parser/samples/binding-shorthand/output.json b/test/parser/samples/binding-shorthand/output.json index 0f10aeb40d..17012db31a 100644 --- a/test/parser/samples/binding-shorthand/output.json +++ b/test/parser/samples/binding-shorthand/output.json @@ -44,20 +44,60 @@ "type": "Program", "start": 8, "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, "body": [ { "type": "VariableDeclaration", "start": 10, "end": 18, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 9 + } + }, "declarations": [ { "type": "VariableDeclarator", "start": 14, "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, "id": { "type": "Identifier", "start": 14, "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, "name": "foo" }, "init": null diff --git a/test/parser/samples/binding/output.json b/test/parser/samples/binding/output.json index e5ebc3fbc7..558215f41a 100644 --- a/test/parser/samples/binding/output.json +++ b/test/parser/samples/binding/output.json @@ -44,20 +44,60 @@ "type": "Program", "start": 8, "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, "body": [ { "type": "VariableDeclaration", "start": 10, "end": 19, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 10 + } + }, "declarations": [ { "type": "VariableDeclarator", "start": 14, "end": 18, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, "id": { "type": "Identifier", "start": 14, "end": 18, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, "name": "name" }, "init": null diff --git a/test/parser/samples/component-dynamic/output.json b/test/parser/samples/component-dynamic/output.json index 77837d1ca9..32cde85f1a 100644 --- a/test/parser/samples/component-dynamic/output.json +++ b/test/parser/samples/component-dynamic/output.json @@ -15,22 +15,62 @@ "type": "ConditionalExpression", "start": 25, "end": 40, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 40 + } + }, "test": { "type": "Identifier", "start": 25, "end": 28, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + }, "name": "foo" }, "consequent": { "type": "Identifier", "start": 31, "end": 34, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + }, "name": "Foo" }, "alternate": { "type": "Identifier", "start": 37, "end": 40, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + } + }, "name": "Bar" } } diff --git a/test/parser/samples/dynamic-import/output.json b/test/parser/samples/dynamic-import/output.json index ce6c7880bc..1e41252afa 100644 --- a/test/parser/samples/dynamic-import/output.json +++ b/test/parser/samples/dynamic-import/output.json @@ -14,26 +14,76 @@ "type": "Program", "start": 8, "end": 137, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + }, "body": [ { "type": "ImportDeclaration", "start": 10, "end": 43, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 34 + } + }, "specifiers": [ { "type": "ImportSpecifier", "start": 19, "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + }, "imported": { "type": "Identifier", "start": 19, "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + }, "name": "onMount" }, "local": { "type": "Identifier", "start": 19, "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 17 + } + }, "name": "onMount" } } @@ -42,6 +92,16 @@ "type": "Literal", "start": 34, "end": 42, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, "value": "svelte", "raw": "'svelte'" } @@ -50,14 +110,44 @@ "type": "ExpressionStatement", "start": 46, "end": 136, + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 8, + "column": 4 + } + }, "expression": { "type": "CallExpression", "start": 46, "end": 135, + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 8, + "column": 3 + } + }, "callee": { "type": "Identifier", "start": 46, "end": 53, + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 8 + } + }, "name": "onMount" }, "arguments": [ @@ -65,6 +155,16 @@ "type": "ArrowFunctionExpression", "start": 54, "end": 134, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 8, + "column": 2 + } + }, "id": null, "expression": false, "generator": false, @@ -74,27 +174,87 @@ "type": "BlockStatement", "start": 60, "end": 134, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 8, + "column": 2 + } + }, "body": [ { "type": "ExpressionStatement", "start": 64, "end": 131, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + }, "expression": { "type": "CallExpression", "start": 64, "end": 130, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 4 + } + }, "callee": { "type": "MemberExpression", "start": 64, "end": 87, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 25 + } + }, "object": { "type": "ImportExpression", "start": 64, "end": 82, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 20 + } + }, "source": { "type": "Literal", "start": 71, "end": 81, + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 19 + } + }, "value": "./foo.js", "raw": "'./foo.js'" } @@ -103,6 +263,16 @@ "type": "Identifier", "start": 83, "end": 87, + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 25 + } + }, "name": "then" }, "computed": false @@ -112,6 +282,16 @@ "type": "ArrowFunctionExpression", "start": 88, "end": 129, + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 7, + "column": 3 + } + }, "id": null, "expression": false, "generator": false, @@ -121,6 +301,16 @@ "type": "Identifier", "start": 88, "end": 91, + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 29 + } + }, "name": "foo" } ], @@ -128,29 +318,89 @@ "type": "BlockStatement", "start": 95, "end": 129, + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 7, + "column": 3 + } + }, "body": [ { "type": "ExpressionStatement", "start": 100, "end": 125, + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 28 + } + }, "expression": { "type": "CallExpression", "start": 100, "end": 124, + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 27 + } + }, "callee": { "type": "MemberExpression", "start": 100, "end": 111, + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 14 + } + }, "object": { "type": "Identifier", "start": 100, "end": 107, + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + }, "name": "console" }, "property": { "type": "Identifier", "start": 108, "end": 111, + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + }, "name": "log" }, "computed": false @@ -160,16 +410,46 @@ "type": "MemberExpression", "start": 112, "end": 123, + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 26 + } + }, "object": { "type": "Identifier", "start": 112, "end": 115, + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 18 + } + }, "name": "foo" }, "property": { "type": "Identifier", "start": 116, "end": 123, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 26 + } + }, "name": "default" }, "computed": false diff --git a/test/parser/samples/each-block-destructured/output.json b/test/parser/samples/each-block-destructured/output.json index 6368b445d6..bafde1324d 100644 --- a/test/parser/samples/each-block-destructured/output.json +++ b/test/parser/samples/each-block-destructured/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 7, "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, "name": "animals" }, "children": [ diff --git a/test/parser/samples/each-block-else/output.json b/test/parser/samples/each-block-else/output.json index 1e8ac455e6..19b5af19b4 100644 --- a/test/parser/samples/each-block-else/output.json +++ b/test/parser/samples/each-block-else/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 7, "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, "name": "animals" }, "children": [ diff --git a/test/parser/samples/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json index 77417ba67a..68a12ea31c 100644 --- a/test/parser/samples/each-block-indexed/output.json +++ b/test/parser/samples/each-block-indexed/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 7, "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, "name": "animals" }, "children": [ diff --git a/test/parser/samples/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json index 11cdd45ff1..61b5442c0d 100644 --- a/test/parser/samples/each-block-keyed/output.json +++ b/test/parser/samples/each-block-keyed/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 7, "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, "name": "todos" }, "children": [ @@ -46,16 +56,46 @@ "type": "MemberExpression", "start": 22, "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + }, "object": { "type": "Identifier", "start": 22, "end": 26, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + }, "name": "todo" }, "property": { "type": "Identifier", "start": 27, "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, "name": "id" }, "computed": false diff --git a/test/parser/samples/each-block/output.json b/test/parser/samples/each-block/output.json index 6a60823952..38bc7e1d04 100644 --- a/test/parser/samples/each-block/output.json +++ b/test/parser/samples/each-block/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 7, "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, "name": "animals" }, "children": [ diff --git a/test/parser/samples/event-handler/output.json b/test/parser/samples/event-handler/output.json index f792ffadcc..44bb83de7d 100644 --- a/test/parser/samples/event-handler/output.json +++ b/test/parser/samples/event-handler/output.json @@ -20,6 +20,16 @@ "type": "ArrowFunctionExpression", "start": 19, "end": 43, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 43 + } + }, "id": null, "expression": true, "generator": false, @@ -29,23 +39,63 @@ "type": "AssignmentExpression", "start": 25, "end": 43, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 43 + } + }, "operator": "=", "left": { "type": "Identifier", "start": 25, "end": 32, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + } + }, "name": "visible" }, "right": { "type": "UnaryExpression", "start": 35, "end": 43, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 43 + } + }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 36, "end": 43, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 43 + } + }, "name": "visible" } } diff --git a/test/parser/samples/if-block-elseif/output.json b/test/parser/samples/if-block-elseif/output.json index 54fb53dacb..0d8fcd987e 100644 --- a/test/parser/samples/if-block-elseif/output.json +++ b/test/parser/samples/if-block-elseif/output.json @@ -12,10 +12,30 @@ "type": "BinaryExpression", "start": 5, "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, "left": { "type": "Identifier", "start": 5, "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, "name": "x" }, "operator": ">", @@ -23,6 +43,16 @@ "type": "Literal", "start": 9, "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, "value": 10, "raw": "10" } @@ -59,10 +89,30 @@ "type": "BinaryExpression", "start": 52, "end": 57, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 15 + } + }, "left": { "type": "Identifier", "start": 52, "end": 53, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, "name": "x" }, "operator": "<", @@ -70,6 +120,16 @@ "type": "Literal", "start": 56, "end": 57, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, "value": 5, "raw": "5" } diff --git a/test/parser/samples/raw-mustaches/output.json b/test/parser/samples/raw-mustaches/output.json index 1b3d9b7a9c..764b6df07d 100644 --- a/test/parser/samples/raw-mustaches/output.json +++ b/test/parser/samples/raw-mustaches/output.json @@ -26,6 +26,16 @@ "type": "Identifier", "start": 11, "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, "name": "raw1" } }, @@ -44,6 +54,16 @@ "type": "Identifier", "start": 24, "end": 28, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + }, "name": "raw2" } }, diff --git a/test/parser/samples/refs/output.json b/test/parser/samples/refs/output.json index 707da89774..72a3d7689c 100644 --- a/test/parser/samples/refs/output.json +++ b/test/parser/samples/refs/output.json @@ -44,20 +44,60 @@ "type": "Program", "start": 8, "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, "body": [ { "type": "VariableDeclaration", "start": 10, "end": 18, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 9 + } + }, "declarations": [ { "type": "VariableDeclarator", "start": 14, "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, "id": { "type": "Identifier", "start": 14, "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, "name": "foo" }, "init": null diff --git a/test/parser/samples/script-comment-only/output.json b/test/parser/samples/script-comment-only/output.json index bc541abcc3..3441d8a7bb 100644 --- a/test/parser/samples/script-comment-only/output.json +++ b/test/parser/samples/script-comment-only/output.json @@ -30,6 +30,16 @@ "type": "Program", "start": 8, "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, "body": [], "sourceType": "module" } diff --git a/test/parser/samples/script-comment-trailing-multiline/output.json b/test/parser/samples/script-comment-trailing-multiline/output.json index ec4f8fe693..3c02b1fbde 100644 --- a/test/parser/samples/script-comment-trailing-multiline/output.json +++ b/test/parser/samples/script-comment-trailing-multiline/output.json @@ -56,26 +56,76 @@ "type": "Program", "start": 8, "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 0 + } + }, "body": [ { "type": "VariableDeclaration", "start": 10, "end": 29, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 20 + } + }, "declarations": [ { "type": "VariableDeclarator", "start": 14, "end": 28, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 19 + } + }, "id": { "type": "Identifier", "start": 14, "end": 18, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, "name": "name" }, "init": { "type": "Literal", "start": 21, "end": 28, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + }, "value": "world", "raw": "'world'" } diff --git a/test/parser/samples/script-comment-trailing/output.json b/test/parser/samples/script-comment-trailing/output.json index 166b1a134b..beca001042 100644 --- a/test/parser/samples/script-comment-trailing/output.json +++ b/test/parser/samples/script-comment-trailing/output.json @@ -56,26 +56,76 @@ "type": "Program", "start": 8, "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 0 + } + }, "body": [ { "type": "VariableDeclaration", "start": 10, "end": 29, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 20 + } + }, "declarations": [ { "type": "VariableDeclarator", "start": 14, "end": 28, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 19 + } + }, "id": { "type": "Identifier", "start": 14, "end": 18, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, "name": "name" }, "init": { "type": "Literal", "start": 21, "end": 28, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + }, "value": "world", "raw": "'world'" } diff --git a/test/parser/samples/script/output.json b/test/parser/samples/script/output.json index 4dee657354..00b7073a19 100644 --- a/test/parser/samples/script/output.json +++ b/test/parser/samples/script/output.json @@ -56,26 +56,76 @@ "type": "Program", "start": 8, "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + }, "body": [ { "type": "VariableDeclaration", "start": 10, "end": 29, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 20 + } + }, "declarations": [ { "type": "VariableDeclarator", "start": 14, "end": 28, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 19 + } + }, "id": { "type": "Identifier", "start": 14, "end": 18, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, "name": "name" }, "init": { "type": "Literal", "start": 21, "end": 28, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + }, "value": "world", "raw": "'world'" } diff --git a/test/parser/samples/self-reference/output.json b/test/parser/samples/self-reference/output.json index 92dfdfe4d0..ea9eecc691 100644 --- a/test/parser/samples/self-reference/output.json +++ b/test/parser/samples/self-reference/output.json @@ -12,10 +12,30 @@ "type": "BinaryExpression", "start": 5, "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, "left": { "type": "Identifier", "start": 5, "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, "name": "depth" }, "operator": ">", @@ -23,6 +43,16 @@ "type": "Literal", "start": 13, "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, "value": 1, "raw": "1" } @@ -48,10 +78,30 @@ "type": "BinaryExpression", "start": 38, "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 31 + } + }, "left": { "type": "Identifier", "start": 38, "end": 43, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 27 + } + }, "name": "depth" }, "operator": "-", @@ -59,6 +109,16 @@ "type": "Literal", "start": 46, "end": 47, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + }, "value": 1, "raw": "1" } diff --git a/test/parser/samples/transition-intro/output.json b/test/parser/samples/transition-intro/output.json index 418bb97e16..1e10f40c42 100644 --- a/test/parser/samples/transition-intro/output.json +++ b/test/parser/samples/transition-intro/output.json @@ -20,11 +20,31 @@ "type": "ObjectExpression", "start": 16, "end": 28, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + }, "properties": [ { "type": "Property", "start": 17, "end": 27, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 27 + } + }, "method": false, "shorthand": false, "computed": false, @@ -32,12 +52,32 @@ "type": "Identifier", "start": 17, "end": 24, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + }, "name": "opacity" }, "value": { "type": "Literal", "start": 26, "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, "value": 0, "raw": "0" }, diff --git a/test/parser/samples/unusual-identifier/output.json b/test/parser/samples/unusual-identifier/output.json index e4a2a18619..76cc82cfd6 100644 --- a/test/parser/samples/unusual-identifier/output.json +++ b/test/parser/samples/unusual-identifier/output.json @@ -12,6 +12,16 @@ "type": "Identifier", "start": 7, "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, "name": "things" }, "children": [ @@ -30,6 +40,16 @@ "type": "Identifier", "start": 26, "end": 28, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 7 + } + }, "name": "𐊧" } } diff --git a/test/sourcemaps/index.js b/test/sourcemaps/index.js index fb5814e8d8..e5915780c6 100644 --- a/test/sourcemaps/index.js +++ b/test/sourcemaps/index.js @@ -5,7 +5,7 @@ import { svelte } from "../helpers.js"; import { SourceMapConsumer } from "source-map"; import { getLocator } from "locate-character"; -describe.only("sourcemaps", () => { +describe("sourcemaps", () => { fs.readdirSync("test/sourcemaps/samples").forEach(dir => { if (dir[0] === ".") return;