From: Junio C Hamano Date: Tue, 02 Jul 2024 15:51:35 GMT Subject: Re: [PATCH 2/6] unit-tests: add TEST_RUN Message-ID: In-Reply-To: <51ebc0fd-ddae-4bdb-a5d6-c92ce8b1f3e6@gmail.com> phillip.wood123@gmail.com 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.