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

@ -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' } ] }