aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema/qapi-schema-test.json
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qapi-schema/qapi-schema-test.json')
-rw-r--r--tests/qapi-schema/qapi-schema-test.json32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
index 8bbf94834a..8ca977c49d 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -114,6 +114,38 @@
{ 'struct': 'UserDefC',
'data': { 'string1': 'str', 'string2': 'str' } }
+# this tests that unions can contain other unions in their branches
+{ 'enum': 'TestUnionEnum',
+ 'data': [ 'value-a', 'value-b' ] }
+
+{ 'enum': 'TestUnionEnumA',
+ 'data': [ 'value-a1', 'value-a2' ] }
+
+{ 'struct': 'TestUnionTypeA1',
+ 'data': { 'integer': 'int',
+ 'name': 'str'} }
+
+{ 'struct': 'TestUnionTypeA2',
+ 'data': { 'integer': 'int',
+ 'size': 'int' } }
+
+{ 'union': 'TestUnionTypeA',
+ 'base': { 'type-a': 'TestUnionEnumA' },
+ 'discriminator': 'type-a',
+ 'data': { 'value-a1': 'TestUnionTypeA1',
+ 'value-a2': 'TestUnionTypeA2' } }
+
+{ 'struct': 'TestUnionTypeB',
+ 'data': { 'integer': 'int',
+ 'onoff': 'bool' } }
+
+{ 'union': 'TestUnionInUnion',
+ 'base': { 'type': 'TestUnionEnum' },
+ 'discriminator': 'type',
+ 'data': { 'value-a': 'TestUnionTypeA',
+ 'value-b': 'TestUnionTypeB' } }
+
+
# for testing use of 'number' within alternates
{ 'alternate': 'AltEnumBool', 'data': { 'e': 'EnumOne', 'b': 'bool' } }
{ 'alternate': 'AltEnumNum', 'data': { 'e': 'EnumOne', 'n': 'number' } }