Re: [PATCH 2/6] unit-tests: add TEST_RUN
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 11, 2024, 15:34 UTC
- Message-ID
- <xmqqa5iot01s.fsf@gitster.g>
- In-Reply-To
- <xmqq8qyblwpn.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
>> I'd automatically assumed we'd want an uppercase name to signal that
>> it was a pre-processor macro but I've not really spent any time
>> thinking about it.
>>
>>> #define test(...) if (TEST_RUN(__VA_ARGS__))
>>> test ("passing test")
>>> check(1);
> ...
> Isn't this introducing a new control structure to the language?
>
> A macro that is a conditional switch (aka "if"-like statement),
> having "if" in the name somewhere, and a macro that wrapts a loop
> around a block (aka "for/while" like statement), having "for" in the
> name somewhere, might be less confusing for the uninitiated.So, perhaps test_if_XXXXXX() but it is not quite clear to me when TEST_RUN() wants to return true, so I cannot come up with an appropriate value to fill the XXXXXX part. If this is about honoring GIT_SKIP_TESTS or something similar, then I may suggest test_if_enabled(), but that does not seem like it. So...