diff options
author | Eric Blake <eblake@redhat.com> | 2015-05-04 09:05:15 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-05-05 18:39:01 +0200 |
commit | 0545f6b8874c28d97369f2c83e5077e0461d4f12 (patch) | |
tree | 592dd6fc1b34696a048038cb582f6b13089a6787 /tests/qapi-schema/unknown-expr-key.json | |
parent | 9050c65b71ac1d197330e6db221f63189e21bad5 (diff) | |
download | qemu-0545f6b8874c28d97369f2c83e5077e0461d4f12.zip qemu-0545f6b8874c28d97369f2c83e5077e0461d4f12.tar.gz qemu-0545f6b8874c28d97369f2c83e5077e0461d4f12.tar.bz2 |
qapi: Better error messages for bad expressions
The previous commit demonstrated that the generator overlooked some
fairly basic broken expressions:
- missing metataype
- metatype key has a non-string value
- unknown key in relation to the metatype
- conflicting metatype (this patch treats the second metatype as an
unknown key of the first key visited, which is not necessarily the
first key the user typed)
Add check_keys to cover these situations, and update testcases to
match. A couple other tests (enum-missing-data, indented-expr) had
to change since the validation added here occurs so early.
Conversely, changes to ident-with-escape results show that we still
have problems where our handling of escape sequences differs from
true JSON, which will matter down the road if we allow arbitrary
default string values for optional parameters (but for now is not
too bad, as we currently can avoid unicode escaping as we don't
need to represent anything beyond C identifier material).
While valid .json files won't trigger any of these cases, we might
as well be nicer to developers that make a typo while trying to add
new QAPI code.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema/unknown-expr-key.json')
-rw-r--r-- | tests/qapi-schema/unknown-expr-key.json | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/qapi-schema/unknown-expr-key.json b/tests/qapi-schema/unknown-expr-key.json index 1e9282d..ba7bdf3 100644 --- a/tests/qapi-schema/unknown-expr-key.json +++ b/tests/qapi-schema/unknown-expr-key.json @@ -1,2 +1,2 @@ -# FIXME: we should reject an expression with unknown top-level keys +# we reject an expression with unknown top-level keys { 'type': 'bar', 'data': { 'string': 'str'}, 'bogus': { } } |