From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb82t-0004h8-He for qemu-devel@nongnu.org; Thu, 26 Mar 2015 09:42:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yb82o-0006fp-95 for qemu-devel@nongnu.org; Thu, 26 Mar 2015 09:42:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb82o-0006fl-0C for qemu-devel@nongnu.org; Thu, 26 Mar 2015 09:41:58 -0400 From: Markus Armbruster References: <1427227433-5030-1-git-send-email-eblake@redhat.com> <1427227433-5030-8-git-send-email-eblake@redhat.com> Date: Thu, 26 Mar 2015 14:41:53 +0100 In-Reply-To: <1427227433-5030-8-git-send-email-eblake@redhat.com> (Eric Blake's message of "Tue, 24 Mar 2015 14:03:32 -0600") Message-ID: <874mp7510e.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v5 07/28] qapi: Simplify tests of simple unions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, lcapitulino@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wenchaoqemu@gmail.com Eric Blake writes: > None of the existing QMP or QGA interfaces uses a union with a > base type but no discriminator; it is easier to avoid this in > the generator to save room for other future extensions more likely > to be useful (the previous commit added the test > union-base-no-discriminator to ensure that we eventually give an > error message). Meanwhile, the tests of UserDefNativeListUnion > serve to validate code generation of simple unions, except that it > did not have full coverage in the strict test. > > Fix some indentation and long lines while at it. > > Signed-off-by: Eric Blake I figure I'd split this commit into two or three parts * kill the undocumented "base in simple union" feature * add the missing tests for UserDefNativeListUnion * style cleanup, possibly squashed into previous Your choice. [...] > diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c > index d5360c6..53134a1 100644 > --- a/tests/test-qmp-input-strict.c > +++ b/tests/test-qmp-input-strict.c [...] > @@ -232,18 +232,19 @@ static void test_validate_fail_list(TestInputVisitorData *data, > qapi_free_UserDefOneList(head); > } > > -static void test_validate_fail_union(TestInputVisitorData *data, > - const void *unused) > +static void test_validate_fail_union_native_list(TestInputVisitorData *data, > + const void *unused) > { > - UserDefUnion *tmp = NULL; > + UserDefNativeListUnion *tmp = NULL; > Error *err = NULL; > Visitor *v; > > - v = validate_test_init(data, "{ 'type': 'b', 'data' : { 'integer': 42 } }"); > + v = validate_test_init(data, > + "{ 'type': 'integer', 'data' : [ \"string\" ] }"); Everywhere else we use ' instead of \". Not worth a respin on its own, clean up on top then. > > - visit_type_UserDefUnion(v, &tmp, NULL, &err); > + visit_type_UserDefNativeListUnion(v, &tmp, NULL, &err); > g_assert(err); > - qapi_free_UserDefUnion(tmp); > + qapi_free_UserDefNativeListUnion(tmp); > } > > static void test_validate_fail_union_flat(TestInputVisitorData *data, [...] Reviewed-by: Markus Armbruster