tests/qapi-schema: Error case tests for features in structs

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20190606153803.5278-4-armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Kevin Wolf 2019-06-06 17:37:59 +02:00 committed by Markus Armbruster
parent 8aa3a33e44
commit a00af40425
25 changed files with 37 additions and 0 deletions

View File

@ -378,6 +378,12 @@ qapi-schema += event-boxed-empty.json
qapi-schema += event-case.json qapi-schema += event-case.json
qapi-schema += event-member-invalid-dict.json qapi-schema += event-member-invalid-dict.json
qapi-schema += event-nest-struct.json qapi-schema += event-nest-struct.json
qapi-schema += features-bad-type.json
qapi-schema += features-duplicate-name.json
qapi-schema += features-missing-name.json
qapi-schema += features-name-bad-type.json
qapi-schema += features-no-list.json
qapi-schema += features-unknown-key.json
qapi-schema += flat-union-array-branch.json qapi-schema += flat-union-array-branch.json
qapi-schema += flat-union-bad-base.json qapi-schema += flat-union-bad-base.json
qapi-schema += flat-union-bad-discriminator.json qapi-schema += flat-union-bad-discriminator.json

View File

@ -0,0 +1 @@
tests/qapi-schema/features-bad-type.json:1: Feature of struct FeatureStruct0 requires a string name

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{ 'struct': 'FeatureStruct0',
'data': { 'foo': 'int' },
'features': [ [ 'a feature cannot be an array' ] ] }

View File

View File

@ -0,0 +1 @@
tests/qapi-schema/features-duplicate-name.json:1: 'foo' (feature of FeatureStruct0) collides with 'foo' (feature of FeatureStruct0)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{ 'struct': 'FeatureStruct0',
'data': { 'foo': 'int' },
'features': [ 'foo', 'bar', 'foo' ] }

View File

@ -0,0 +1 @@
tests/qapi-schema/features-missing-name.json:1: Key 'name' is missing from feature of struct FeatureStruct0

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{ 'struct': 'FeatureStruct0',
'data': { 'foo': 'int' },
'features': [ { 'if': 'defined(NAMELESS_FEATURES)' } ] }

View File

@ -0,0 +1 @@
tests/qapi-schema/features-name-bad-type.json:1: Feature of struct FeatureStruct0 requires a string name

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{ 'struct': 'FeatureStruct0',
'data': { 'foo': 'int' },
'features': [ { 'name': { 'feature-type': 'object' } } ] }

View File

@ -0,0 +1 @@
tests/qapi-schema/features-no-list.json:1: Struct 'FeatureStruct0' requires an array for 'features'

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{ 'struct': 'FeatureStruct0',
'data': { 'foo': 'int' },
'features': 'bar' }

View File

View File

@ -0,0 +1,2 @@
tests/qapi-schema/features-unknown-key.json:1: Unknown key 'colour' in feature of struct FeatureStruct0
Valid keys are 'if', 'name'.

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
{ 'struct': 'FeatureStruct0',
'data': { 'foo': 'int' },
'features': [ { 'name': 'bar', 'colour': 'red' } ] }