From 58e3339862a71c2bd163e3d7559e03931cf14e5d Mon Sep 17 00:00:00 2001 From: rster20002 Date: Tue, 20 Apr 2021 15:39:42 +0200 Subject: [PATCH] Changed the error message to be more descriptive Added test --- src/compiler/parse/state/tag.ts | 2 +- .../samples/error-empty-attribute-shorthand/error.json | 10 ++++++++++ .../error-empty-attribute-shorthand/input.svelte | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/parser/samples/error-empty-attribute-shorthand/error.json create mode 100644 test/parser/samples/error-empty-attribute-shorthand/input.svelte diff --git a/src/compiler/parse/state/tag.ts b/src/compiler/parse/state/tag.ts index a936ab3bd4..9071e66032 100644 --- a/src/compiler/parse/state/tag.ts +++ b/src/compiler/parse/state/tag.ts @@ -333,7 +333,7 @@ function read_attribute(parser: Parser, unique_names: Set) { if (name === null) { parser.error({ code: 'empty-attribute-value', - message: 'Empty attribute shorthand' + message: 'Attribute shorthand cannot be empty' }, start); } diff --git a/test/parser/samples/error-empty-attribute-shorthand/error.json b/test/parser/samples/error-empty-attribute-shorthand/error.json new file mode 100644 index 0000000000..093e581edc --- /dev/null +++ b/test/parser/samples/error-empty-attribute-shorthand/error.json @@ -0,0 +1,10 @@ +{ + "code": "empty-attribute-value", + "message": "Attribute shorthand cannot be empty", + "start": { + "line": 1, + "column": 6, + "character": 6 + }, + "pos": 6 +} \ No newline at end of file diff --git a/test/parser/samples/error-empty-attribute-shorthand/input.svelte b/test/parser/samples/error-empty-attribute-shorthand/input.svelte new file mode 100644 index 0000000000..2e137c8c6d --- /dev/null +++ b/test/parser/samples/error-empty-attribute-shorthand/input.svelte @@ -0,0 +1 @@ + \ No newline at end of file