浏览代码

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>
Kevin Wolf 6 年之前
父节点
当前提交
a00af40425

+ 6 - 0
tests/Makefile.include

@@ -378,6 +378,12 @@ qapi-schema += event-boxed-empty.json
 qapi-schema += event-case.json
 qapi-schema += event-member-invalid-dict.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-bad-base.json
 qapi-schema += flat-union-bad-discriminator.json

+ 1 - 0
tests/qapi-schema/features-bad-type.err

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

+ 1 - 0
tests/qapi-schema/features-bad-type.exit

@@ -0,0 +1 @@
+1

+ 3 - 0
tests/qapi-schema/features-bad-type.json

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

+ 0 - 0
tests/qapi-schema/features-bad-type.out


+ 1 - 0
tests/qapi-schema/features-duplicate-name.err

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

+ 1 - 0
tests/qapi-schema/features-duplicate-name.exit

@@ -0,0 +1 @@
+1

+ 3 - 0
tests/qapi-schema/features-duplicate-name.json

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

+ 0 - 0
tests/qapi-schema/features-duplicate-name.out


+ 1 - 0
tests/qapi-schema/features-missing-name.err

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

+ 1 - 0
tests/qapi-schema/features-missing-name.exit

@@ -0,0 +1 @@
+1

+ 3 - 0
tests/qapi-schema/features-missing-name.json

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

+ 0 - 0
tests/qapi-schema/features-missing-name.out


+ 1 - 0
tests/qapi-schema/features-name-bad-type.err

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

+ 1 - 0
tests/qapi-schema/features-name-bad-type.exit

@@ -0,0 +1 @@
+1

+ 3 - 0
tests/qapi-schema/features-name-bad-type.json

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

+ 0 - 0
tests/qapi-schema/features-name-bad-type.out


+ 1 - 0
tests/qapi-schema/features-no-list.err

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

+ 1 - 0
tests/qapi-schema/features-no-list.exit

@@ -0,0 +1 @@
+1

+ 3 - 0
tests/qapi-schema/features-no-list.json

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

+ 0 - 0
tests/qapi-schema/features-no-list.out


+ 2 - 0
tests/qapi-schema/features-unknown-key.err

@@ -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'.

+ 1 - 0
tests/qapi-schema/features-unknown-key.exit

@@ -0,0 +1 @@
+1

+ 3 - 0
tests/qapi-schema/features-unknown-key.json

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

+ 0 - 0
tests/qapi-schema/features-unknown-key.out