From 27f799a2de3a30d514b7e97b22b1a605b949a03d Mon Sep 17 00:00:00 2001 From: tanhauhau Date: Thu, 13 Jan 2022 22:52:53 +0800 Subject: [PATCH] add test to validate no error --- .../input.svelte | 1 - .../output.json | 94 ------------------- .../animation-each-with-const/errors.json | 1 + .../animation-each-with-const/input.svelte | 10 ++ .../errors.json | 1 + .../input.svelte | 7 ++ 6 files changed, 19 insertions(+), 95 deletions(-) delete mode 100644 test/parser/samples/animation-each-with-whitespace/input.svelte delete mode 100644 test/parser/samples/animation-each-with-whitespace/output.json create mode 100644 test/validator/samples/animation-each-with-const/errors.json create mode 100644 test/validator/samples/animation-each-with-const/input.svelte create mode 100644 test/validator/samples/animation-each-with-whitespace/errors.json create mode 100644 test/validator/samples/animation-each-with-whitespace/input.svelte diff --git a/test/parser/samples/animation-each-with-whitespace/input.svelte b/test/parser/samples/animation-each-with-whitespace/input.svelte deleted file mode 100644 index 08e4d20f44..0000000000 --- a/test/parser/samples/animation-each-with-whitespace/input.svelte +++ /dev/null @@ -1 +0,0 @@ -
{#each [] as n (n)}
{/each}
diff --git a/test/parser/samples/animation-each-with-whitespace/output.json b/test/parser/samples/animation-each-with-whitespace/output.json deleted file mode 100644 index da9d7feb9e..0000000000 --- a/test/parser/samples/animation-each-with-whitespace/output.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "html": { - "start": 0, - "end": 59, - "type": "Fragment", - "children": [ - { - "start": 0, - "end": 59, - "type": "Element", - "name": "div", - "attributes": [], - "children": [ - { - "start": 5, - "end": 53, - "type": "EachBlock", - "expression": { - "type": "ArrayExpression", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "elements": [] - }, - "children": [ - { - "start": 24, - "end": 25, - "type": "Text", - "raw": " ", - "data": " " - }, - { - "start": 25, - "end": 45, - "type": "Element", - "name": "div", - "attributes": [ - { - "start": 30, - "end": 42, - "type": "Animation", - "name": "flip", - "modifiers": [], - "expression": null - } - ], - "children": [] - }, - { - "start": 45, - "end": 46, - "type": "Text", - "raw": " ", - "data": " " - } - ], - "context": { - "type": "Identifier", - "name": "n", - "start": 18, - "end": 19 - }, - "key": { - "type": "Identifier", - "start": 21, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "n" - } - } - ] - } - ] - } -} \ No newline at end of file diff --git a/test/validator/samples/animation-each-with-const/errors.json b/test/validator/samples/animation-each-with-const/errors.json new file mode 100644 index 0000000000..0637a088a0 --- /dev/null +++ b/test/validator/samples/animation-each-with-const/errors.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test/validator/samples/animation-each-with-const/input.svelte b/test/validator/samples/animation-each-with-const/input.svelte new file mode 100644 index 0000000000..1e236de76f --- /dev/null +++ b/test/validator/samples/animation-each-with-const/input.svelte @@ -0,0 +1,10 @@ + + +
+ {#each [] as n (n)} + {@const a = n} +
+ {/each} +
diff --git a/test/validator/samples/animation-each-with-whitespace/errors.json b/test/validator/samples/animation-each-with-whitespace/errors.json new file mode 100644 index 0000000000..0637a088a0 --- /dev/null +++ b/test/validator/samples/animation-each-with-whitespace/errors.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test/validator/samples/animation-each-with-whitespace/input.svelte b/test/validator/samples/animation-each-with-whitespace/input.svelte new file mode 100644 index 0000000000..3e063716ab --- /dev/null +++ b/test/validator/samples/animation-each-with-whitespace/input.svelte @@ -0,0 +1,7 @@ + + +
+ {#each [] as n (n)}
{/each} +