]> Git Repo - qemu.git/commitdiff
tests/qapi-schema: Demonstrate suboptimal lexical errors
authorMarkus Armbruster <[email protected]>
Sat, 14 Sep 2019 15:34:53 +0000 (17:34 +0200)
committerMarkus Armbruster <[email protected]>
Tue, 24 Sep 2019 12:07:23 +0000 (14:07 +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 <[email protected]>
Message-Id: <20190914153506[email protected]>
Reviewed-by: Eric Blake <[email protected]>
tests/Makefile.include
tests/qapi-schema/bad-type-int.json
tests/qapi-schema/funny-word.err [new file with mode: 0644]
tests/qapi-schema/funny-word.exit [new file with mode: 0644]
tests/qapi-schema/funny-word.json [new file with mode: 0644]
tests/qapi-schema/funny-word.out [new file with mode: 0644]

index 799fd4af02fd9db859572f42a4daec199cf67dca..0595914526697fb73af729f3aec8893cfeec2b1c 100644 (file)
@@ -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
index 56fc6f81264c5d5dd2b9d0a67e9e3d23939d43d7..f3ad803cb6e9cd205c1197246c3e2aef224805b3 100644 (file)
@@ -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 (file)
index 0000000..0a44057
--- /dev/null
@@ -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 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/funny-word.json b/tests/qapi-schema/funny-word.json
new file mode 100644 (file)
index 0000000..1153b9f
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
This page took 0.03378 seconds and 4 git commands to generate.