Subject: Re: [RFC PATCH v2 1/6] t0080: turn t-basic unit test into a helper

From: Junio C Hamano <[email-masked]>
Date: Wed, 07 Feb 2024 12:55:16 -0800

Josh Steadmon <[email-masked]> writes:

> -UNIT_TEST_PROGRAMS = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES))
> -UNIT_TESTS = $(sort $(filter-out unit-tests/bin/t-basic%,$(UNIT_TEST_PROGRAMS)))
> +UNIT_TESTS = $(patsubst unit-tests/%.c,unit-tests/bin/%$(X),$(UNIT_TEST_SOURCES))

Nice that we no longer need the special casing.

> diff --git a/t/unit-tests/t-basic.c b/t/helper/test-example-tap.c
> similarity index 95%
> rename from t/unit-tests/t-basic.c
> rename to t/helper/test-example-tap.c
> index fda1ae59a6..21e4848e78 100644
> --- a/t/unit-tests/t-basic.c
> +++ b/t/helper/test-example-tap.c
> @@ -1,4 +1,5 @@
> -#include "test-lib.h"
> +#include "t/unit-tests/test-lib.h"
> +#include "test-tool.h"

As the first thing both of these headers include is
"git-compat-util.h", so the ordering should be safe either way,
because everybody else in the directory seems to include
"test-tool.h" before including headers that are specific to the
subsystem it is testing, and "t/unit-tests/test-lib.h" in this case
is the header that is specific to the unit-test subsystem being
tested, it may raise fewer eyebrows if we swapped the order of the
inclusion here.

Other than that, looks good to me.

Thanks.