From 68d078395d8233ca8455a95f05e5c23e367777c2 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 17 Feb 2016 23:48:18 -0700 Subject: qapi: Add tests of complex objects within alternate Upcoming patches will adjust how we visit an object branch of an alternate; but we were completely lacking testsuite coverage. Rectify this, so that the future patches will be able to highlight the changes and still prove that we avoided regressions. In particular, the use of a flat union UserDefFlatUnion rather than a simple struct UserDefA as the branch will give us coverage of an object with variants. And visiting an alternate as both the top level and as a nested member gives confidence in correct memory allocation handling, especially if the test is run under valgrind. Signed-off-by: Eric Blake Message-Id: <1455778109-6278-5-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster --- tests/qapi-schema/qapi-schema-test.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/qapi-schema/qapi-schema-test.json') diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index 353a34eee4..632964a6ec 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -85,8 +85,10 @@ 'data': { 'value1' : 'UserDefC', # intentional forward reference 'value2' : 'UserDefB' } } +{ 'struct': 'WrapAlternate', + 'data': { 'alt': 'UserDefAlternate' } } { 'alternate': 'UserDefAlternate', - 'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } } + 'data': { 'udfu': 'UserDefFlatUnion', 's': 'str', 'i': 'int' } } { 'struct': 'UserDefC', 'data': { 'string1': 'str', 'string2': 'str' } } -- cgit v1.2.3