tests/qapi-schema: Improve union discriminator coverage
authorMarkus Armbruster <armbru@redhat.com>
Thu, 16 Mar 2023 07:13:20 +0000 (08:13 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 24 Apr 2023 13:21:39 +0000 (15:21 +0200)
commit8fba2f737a372be07739aefeea16c09614a152f0
tree0151b68e16418052d32bb606d73ab272472efc0a
parente2050ef633f77781e6b7b3aa04dd736e0ad825e1
tests/qapi-schema: Improve union discriminator coverage

A union's 'discriminator' must name one of the common members.
QAPISchemaVariants.check() looks it up by its c_name(), then checks
the name matches exactly (because c_name() is not injective).

Tests union-base-empty and union-invalid-discriminator both cover the
case where lookup fails.  Repurpose the latter to cover the case where
it succeeds and the name check fails.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230316071325.492471-10-armbru@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
[Commit message typo fixed]
tests/qapi-schema/union-invalid-discriminator.err
tests/qapi-schema/union-invalid-discriminator.json