aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema/union-base-union.json
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qapi-schema/union-base-union.json')
-rw-r--r--tests/qapi-schema/union-base-union.json21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/qapi-schema/union-base-union.json b/tests/qapi-schema/union-base-union.json
new file mode 100644
index 0000000000..82d4c96e57
--- /dev/null
+++ b/tests/qapi-schema/union-base-union.json
@@ -0,0 +1,21 @@
+# For now, we require the base to be a struct without variants
+# TODO: It would be possible to allow a union as a base, as long as all
+# permutations of QMP names exposed by base do not clash with any QMP
+# member names added by local variants.
+{ 'enum': 'TestEnum',
+ 'data': [ 'value1', 'value2' ] }
+{ 'struct': 'TestTypeA',
+ 'data': { 'string': 'str' } }
+{ 'struct': 'TestTypeB',
+ 'data': { 'integer': 'int' } }
+{ 'enum': 'Enum', 'data': [ 'kind1', 'kind2' ] }
+{ 'union': 'UnionBase',
+ 'base': { 'type': 'Enum' },
+ 'discriminator': 'type',
+ 'data': { 'kind1': 'TestTypeA',
+ 'kind2': 'TestTypeB' } }
+{ 'union': 'TestUnion',
+ 'base': 'UnionBase',
+ 'discriminator': 'type',
+ 'data': { 'kind1': 'TestTypeA',
+ 'kind2': 'TestTypeB' } }