OSDN Git Service

qapi-schema: test: add a qapi-schema-test for array alternates
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 21 Mar 2022 16:42:42 +0000 (17:42 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 21 Apr 2022 08:11:25 +0000 (10:11 +0200)
Check that conflicts among array alternates are detected correctly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220321164243.200569-3-pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Expected test output alternate-conflict-lists.json corrected]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
tests/qapi-schema/alternate-conflict-lists.err [new file with mode: 0644]
tests/qapi-schema/alternate-conflict-lists.json [new file with mode: 0644]
tests/qapi-schema/alternate-conflict-lists.out [new file with mode: 0644]
tests/qapi-schema/meson.build

diff --git a/tests/qapi-schema/alternate-conflict-lists.err b/tests/qapi-schema/alternate-conflict-lists.err
new file mode 100644 (file)
index 0000000..f3374ec
--- /dev/null
@@ -0,0 +1,2 @@
+alternate-conflict-lists.json: In alternate 'Alt':
+alternate-conflict-lists.json:4: branch 'two' can't be distinguished from 'one'
diff --git a/tests/qapi-schema/alternate-conflict-lists.json b/tests/qapi-schema/alternate-conflict-lists.json
new file mode 100644 (file)
index 0000000..a3efd6c
--- /dev/null
@@ -0,0 +1,6 @@
+# Two lists conflict even if their inner types would be compatible
+{ 'struct': 'One',
+  'data': { 'name': 'str' } }
+{ 'alternate': 'Alt',
+  'data': { 'one': [ 'int' ],
+            'two': [ 'str' ] } }
diff --git a/tests/qapi-schema/alternate-conflict-lists.out b/tests/qapi-schema/alternate-conflict-lists.out
new file mode 100644 (file)
index 0000000..e69de29
index caf0791..c18dd7d 100644 (file)
@@ -11,6 +11,7 @@ schemas = [
   'alternate-conflict-dict.json',
   'alternate-conflict-enum-bool.json',
   'alternate-conflict-enum-int.json',
+  'alternate-conflict-lists.json',
   'alternate-conflict-string.json',
   'alternate-conflict-bool-string.json',
   'alternate-conflict-num-string.json',