Re: [PATCH 1/2] t/unit-tests: match functions signature with trailing code
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 8, 2025, 15:27 UTC
- Message-ID
- <xmqqcygxpbpy.fsf@gitster.g>
- In-Reply-To
- <Z34XvPjhY15MFHrT@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> So I agree with you, let's scrap the idea and have proper function > bodies instead.
Yup, sometimes, simple, stupid, and good enough is the way to go.
We could do
-- >8 --
#define T(testname, input, expect1, expect256) \
void test_hash__ ## testname(void) \
{ \
const char *expect[] = { expect1, expect256 }; \
check_hash_data(input, strlen(input), expect); \
} extern void test_hash__ ## testname()T(empty_string, "", "da39...", "e3b0c4..."); T(single_character, "a", "86f7e4...", "ca97811...");
-- 8< --
which may not upset syntax-aware editors too much.
Unless there are more than several dozens of them, I do not think it is worth it, though ;-)