aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema/flat-union-no-base.json
diff options
context:
space:
mode:
authorWenchao Xia <wenchaoqemu@gmail.com>2014-03-04 18:44:34 -0800
committerLuiz Capitulino <lcapitulino@redhat.com>2014-03-11 09:07:41 -0400
commitb86b05ed60d8d49c5770851860d4e6b89c133e7e (patch)
tree9ed9cacbd824b62244593355b1cc4ab262bd0795 /tests/qapi-schema/flat-union-no-base.json
parent515b943a91db6c9faf9e35377c18db9ca32ecb40 (diff)
qapi script: check correctness of union
Since line info is remembered as QAPISchema.line now, this patch uses it as additional info for every expr in QAPISchema inside qapi.py, then improves error message with it in checking of exprs. For common union the patch will check whether base is a valid complex type if specified. For flat union it will check whether base presents, whether discriminator is found in base, whether the key of every branch is correct when discriminator is an enum type. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'tests/qapi-schema/flat-union-no-base.json')
-rw-r--r--tests/qapi-schema/flat-union-no-base.json10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/qapi-schema/flat-union-no-base.json b/tests/qapi-schema/flat-union-no-base.json
new file mode 100644
index 0000000000..50f267323b
--- /dev/null
+++ b/tests/qapi-schema/flat-union-no-base.json
@@ -0,0 +1,10 @@
+{ 'type': 'TestTypeA',
+ 'data': { 'string': 'str' } }
+
+{ 'type': 'TestTypeB',
+ 'data': { 'integer': 'int' } }
+
+{ 'union': 'TestUnion',
+ 'discriminator': 'enum1',
+ 'data': { 'value1': 'TestTypeA',
+ 'value2': 'TestTypeB' } }