[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/37] tests/qapi-schema: Demonstrate suboptimal lexical errors
From: |
Markus Armbruster |
Subject: |
[PULL 24/37] tests/qapi-schema: Demonstrate suboptimal lexical errors |
Date: |
Tue, 24 Sep 2019 14:33:21 +0200 |
The error message for forgotten quotes around a name shows just the
name's first character, which isn't as nice as it could be. Same for
attempting to use a number.
Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
tests/Makefile.include | 1 +
tests/qapi-schema/bad-type-int.json | 2 +-
tests/qapi-schema/funny-word.err | 1 +
tests/qapi-schema/funny-word.exit | 1 +
tests/qapi-schema/funny-word.json | 1 +
tests/qapi-schema/funny-word.out | 0
6 files changed, 5 insertions(+), 1 deletion(-)
create mode 100644 tests/qapi-schema/funny-word.err
create mode 100644 tests/qapi-schema/funny-word.exit
create mode 100644 tests/qapi-schema/funny-word.json
create mode 100644 tests/qapi-schema/funny-word.out
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 799fd4af02..0595914526 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -402,6 +402,7 @@ qapi-schema += flat-union-no-base.json
qapi-schema += flat-union-optional-discriminator.json
qapi-schema += flat-union-string-discriminator.json
qapi-schema += funny-char.json
+qapi-schema += funny-word.json
qapi-schema += ident-with-escape.json
qapi-schema += include-before-err.json
qapi-schema += include-cycle.json
diff --git a/tests/qapi-schema/bad-type-int.json
b/tests/qapi-schema/bad-type-int.json
index 56fc6f8126..f3ad803cb6 100644
--- a/tests/qapi-schema/bad-type-int.json
+++ b/tests/qapi-schema/bad-type-int.json
@@ -1,3 +1,3 @@
# we reject an expression with a metatype that is not a string
# FIXME: once the parser understands integer inputs, improve the error message
-{ 'struct': 1, 'data': { } }
+{ 'struct': 123, 'data': { } }
diff --git a/tests/qapi-schema/funny-word.err b/tests/qapi-schema/funny-word.err
new file mode 100644
index 0000000000..0a440574bd
--- /dev/null
+++ b/tests/qapi-schema/funny-word.err
@@ -0,0 +1 @@
+tests/qapi-schema/funny-word.json:1:3: Stray "c"
diff --git a/tests/qapi-schema/funny-word.exit
b/tests/qapi-schema/funny-word.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/funny-word.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/funny-word.json
b/tests/qapi-schema/funny-word.json
new file mode 100644
index 0000000000..1153b9f12f
--- /dev/null
+++ b/tests/qapi-schema/funny-word.json
@@ -0,0 +1 @@
+{ command: 'foo' }
diff --git a/tests/qapi-schema/funny-word.out b/tests/qapi-schema/funny-word.out
new file mode 100644
index 0000000000..e69de29bb2
--
2.21.0
- [PULL 27/37] qapi: Remove null from schema language, (continued)
- [PULL 27/37] qapi: Remove null from schema language, Markus Armbruster, 2019/09/24
- [PULL 13/37] qapi: Adjust frontend errors to say enum value, not member, Markus Armbruster, 2019/09/24
- [PULL 26/37] qapi: Improve reporting of lexical errors, Markus Armbruster, 2019/09/24
- [PULL 10/37] qapi: Permit 'boxed' with empty type, Markus Armbruster, 2019/09/24
- [PULL 37/37] qapi: Assert .visit() and .check_clash() run only after .check(), Markus Armbruster, 2019/09/24
- [PULL 22/37] tests/qapi-schema: Demonstrate broken discriminator errors, Markus Armbruster, 2019/09/24
- [PULL 03/37] scripts/git.orderfile: Match QAPI schema more precisely, Markus Armbruster, 2019/09/24
- [PULL 12/37] qapi: Permit omitting all flat union branches, Markus Armbruster, 2019/09/24
- [PULL 15/37] docs/devel/qapi-code-gen: Rewrite compatibility considerations, Markus Armbruster, 2019/09/24
- [PULL 20/37] tests/qapi-schema: Delete two redundant tests, Markus Armbruster, 2019/09/24
- [PULL 24/37] tests/qapi-schema: Demonstrate suboptimal lexical errors,
Markus Armbruster <=
- [PULL 09/37] qapi: Drop support for escape sequences other than \\, Markus Armbruster, 2019/09/24
- [PULL 21/37] tests/qapi-schema: Demonstrate misleading optional tag error, Markus Armbruster, 2019/09/24
- [PULL 16/37] docs/devel/qapi-code-gen: Rewrite introduction to schema, Markus Armbruster, 2019/09/24
- [PULL 18/37] qapi: Tweak code to match docs/devel/qapi-code-gen.txt, Markus Armbruster, 2019/09/24
- [PULL 25/37] qapi: Use quotes more consistently in frontend error messages, Markus Armbruster, 2019/09/24
- [PULL 17/37] docs/devel/qapi-code-gen: Improve QAPI schema language doc, Markus Armbruster, 2019/09/24
- [PULL 31/37] qapi: Normalize 'if' in check_exprs(), like other sugar, Markus Armbruster, 2019/09/24
- [PULL 28/37] qapi: Fix broken discriminator error messages, Markus Armbruster, 2019/09/24
- [PULL 08/37] qapi: Restrict strings to printable ASCII, Markus Armbruster, 2019/09/24
- [PULL 36/37] qapi: Fix excessive QAPISchemaEntity.check() recursion, Markus Armbruster, 2019/09/24