Re: [PATCH 1/2] t/unit-tests: match functions signature with trailing code
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 8, 2025, 16:15 UTC
- Message-ID
- <Z36kqlcKl20AkJvW@pks.im>
- In-Reply-To
- <xmqqcygxpbpy.fsf@gitster.g>
On Wed, Jan 08, 2025 at 07:27:37AM -0800, Junio C Hamano wrote:
Show 27 quoted lines
> 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 ;-)Agreed, I'd go with the simple solution for now, which is to have function bodies.
Patrick