[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/14] tests/qapi-schema: Improve union discriminator coverag
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 09/14] tests/qapi-schema: Improve union discriminator coverage |
Date: |
Fri, 17 Mar 2023 06:51:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Eric Blake <eblake@redhat.com> writes:
> On Thu, Mar 16, 2023 at 08:13:20AM +0100, Markus Armbruster wrote:
>> A union's 'discriminator' must name a one of the common members.
>
> s/ a//
Yes.
>> 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>
>> ---
>> tests/qapi-schema/union-invalid-discriminator.err | 2 +-
>> tests/qapi-schema/union-invalid-discriminator.json | 4 ++--
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> (- vs. _ is subtle, especially since I purposefully case-map them to
> one another whenever I can...)
Abusing the clash checking machinery to look up the the tag member is
kind of hacky, and it's why we have this odd case to cover.
Thanks!
- [PATCH 04/14] qapi: Split up check_type(), (continued)
- [PATCH 04/14] qapi: Split up check_type(), Markus Armbruster, 2023/03/16
- [PATCH 03/14] qapi: Clean up after removal of simple unions, Markus Armbruster, 2023/03/16
- [PATCH 06/14] qapi: Simplify code a bit after previous commit, Markus Armbruster, 2023/03/16
- [PATCH 09/14] tests/qapi-schema: Improve union discriminator coverage, Markus Armbruster, 2023/03/16
- [PATCH 07/14] qapi: Fix error message when type name or array is expected, Markus Armbruster, 2023/03/16
- [PATCH 10/14] tests/qapi-schema: Rename a few conditionals, Markus Armbruster, 2023/03/16