Re: [PATCH 2/6] unit-tests: add TEST_RUN
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 2, 2024, 15:51 UTC
- Message-ID
- <xmqqle2jssfs.fsf@gitster.g>
- In-Reply-To
- <51ebc0fd-ddae-4bdb-a5d6-c92ce8b1f3e6@gmail.com>
phillip.wood123@gmail.com writes:
Show 5 quoted lines
>> 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?
Show 11 quoted lines
>> @@ -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.