Subject: Re: [PATCH 2/6] unit-tests: add TEST_RUN

From: Junio C Hamano <[email-masked]>
Date: Tue, 02 Jul 2024 08:51:35 -0700

[email-masked] writes:

>> No public method is provided for ending a test explicitly, yet; let's
>> see if we'll ever need one.
>
> This means that we do not error out if there are accidentally nested
> tests. That probably does not matter too much.

Isn't it more like it is impossible to create nested tests, since a
"begin" implicitly ends the current one before starting the new one?

>> @@ -156,6 +163,7 @@ extern union test__tmp test__tmp[2];
>>   int test__run_begin(void);
>>   __attribute__((format (printf, 3, 4)))
>>   int test__run_end(int, const char *, const char *, ...);
>
> We should add
>
>     __attribute__((format (printf, 2, 3), warn_unused_result))
>
> here to catch any errors in the format string / arguments and to warn
> if TEST_RUN() isn't wrapped in an if() statement.

Nice.  Especially the "unused" check is valuable.

Thanks.