Eric Blake <ebl...@redhat.com> 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 <ebl...@redhat.com>
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 <arm...@redhat.com>