diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-03-15 13:57:25 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-03-16 07:13:03 +0100 |
commit | f641d06ad63773ae524fb073b2f8639e1db1462c (patch) | |
tree | 263f3c00dd5bd52810818d6944eb2981b668398d | |
parent | bdc001caaa60dd71af8cddf73688f28ac5a32bc2 (diff) | |
download | qemu-f641d06ad63773ae524fb073b2f8639e1db1462c.zip qemu-f641d06ad63773ae524fb073b2f8639e1db1462c.tar.gz qemu-f641d06ad63773ae524fb073b2f8639e1db1462c.tar.bz2 |
tests/qapi-schema: Improve coverage of bogus member docs
New test doc-bad-union-member.json shows we can fail to reject
documentation for nonexistent members.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1489582656-31133-37-git-send-email-armbru@redhat.com>
-rw-r--r-- | tests/Makefile.include | 2 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-alternate-member.err | 1 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-alternate-member.exit | 1 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-alternate-member.json | 9 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-alternate-member.out | 0 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-union-member.err | 0 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-union-member.exit | 1 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-union-member.json | 19 | ||||
-rw-r--r-- | tests/qapi-schema/doc-bad-union-member.out | 11 |
9 files changed, 44 insertions, 0 deletions
diff --git a/tests/Makefile.include b/tests/Makefile.include index 734c7ff..e6e00b4 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -367,8 +367,10 @@ qapi-schema += base-cycle-direct.json qapi-schema += base-cycle-indirect.json qapi-schema += command-int.json qapi-schema += comments.json +qapi-schema += doc-bad-alternate-member.json qapi-schema += doc-bad-command-arg.json qapi-schema += doc-bad-symbol.json +qapi-schema += doc-bad-union-member.json qapi-schema += doc-before-include.json qapi-schema += doc-before-pragma.json qapi-schema += doc-duplicated-arg.json diff --git a/tests/qapi-schema/doc-bad-alternate-member.err b/tests/qapi-schema/doc-bad-alternate-member.err new file mode 100644 index 0000000..387f782 --- /dev/null +++ b/tests/qapi-schema/doc-bad-alternate-member.err @@ -0,0 +1 @@ +tests/qapi-schema/doc-bad-alternate-member.json:3: The following documented members are not in the declaration: aa, bb diff --git a/tests/qapi-schema/doc-bad-alternate-member.exit b/tests/qapi-schema/doc-bad-alternate-member.exit new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tests/qapi-schema/doc-bad-alternate-member.exit @@ -0,0 +1 @@ +1 diff --git a/tests/qapi-schema/doc-bad-alternate-member.json b/tests/qapi-schema/doc-bad-alternate-member.json new file mode 100644 index 0000000..738635c --- /dev/null +++ b/tests/qapi-schema/doc-bad-alternate-member.json @@ -0,0 +1,9 @@ +# Arguments listed in the doc comment must exist in the actual schema + +## +# @AorB: +# @aa: a +# @bb: b +## +{ 'alternate': 'AorB', + 'data': { 'a': 'str', 'b': 'int' } } diff --git a/tests/qapi-schema/doc-bad-alternate-member.out b/tests/qapi-schema/doc-bad-alternate-member.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/qapi-schema/doc-bad-alternate-member.out diff --git a/tests/qapi-schema/doc-bad-union-member.err b/tests/qapi-schema/doc-bad-union-member.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/qapi-schema/doc-bad-union-member.err diff --git a/tests/qapi-schema/doc-bad-union-member.exit b/tests/qapi-schema/doc-bad-union-member.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/doc-bad-union-member.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/doc-bad-union-member.json b/tests/qapi-schema/doc-bad-union-member.json new file mode 100644 index 0000000..d611435 --- /dev/null +++ b/tests/qapi-schema/doc-bad-union-member.json @@ -0,0 +1,19 @@ +# Arguments listed in the doc comment must exist in the actual schema + +## +# @Frob: +# @a: a +# @b: b +## +{ 'union': 'Frob', + 'base': 'Base', + 'discriminator': 'type', + 'data': { 'nothing': 'Empty' } } + +{ 'struct': 'Base', + 'data': { 'type': 'T' } } + +{ 'struct': 'Empty', + 'data': { } } + +{ 'enum': 'T', 'data': ['nothing'] } diff --git a/tests/qapi-schema/doc-bad-union-member.out b/tests/qapi-schema/doc-bad-union-member.out new file mode 100644 index 0000000..2576ecd --- /dev/null +++ b/tests/qapi-schema/doc-bad-union-member.out @@ -0,0 +1,11 @@ +object Base + member type: T optional=False +object Empty +object Frob + base Base + tag type + case nothing: Empty +enum QType ['none', 'qnull', 'qint', 'qstring', 'qdict', 'qlist', 'qfloat', 'qbool'] + prefix QTYPE +enum T ['nothing'] +object q_empty |