Parcourir la source

tests/qapi-schema: Demonstrate suboptimal lexical errors

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 <armbru@redhat.com>
Message-Id: <20190914153506.2151-7-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Markus Armbruster il y a 6 ans
Parent
commit
4d42815587

+ 1 - 0
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

+ 1 - 1
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': { } }

+ 1 - 0
tests/qapi-schema/funny-word.err

@@ -0,0 +1 @@
+tests/qapi-schema/funny-word.json:1:3: Stray "c"

+ 1 - 0
tests/qapi-schema/funny-word.exit

@@ -0,0 +1 @@
+1

+ 1 - 0
tests/qapi-schema/funny-word.json

@@ -0,0 +1 @@
+{ command: 'foo' }

+ 0 - 0
tests/qapi-schema/funny-word.out