Re: [PATCH v2 3/1] t-strvec: tighten .alloc check in check_strvec
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 15, 2024, 14:43 UTC
- Message-ID
- <xmqqjzhm90mb.fsf@gitster.g>
- In-Reply-To
- <075b3d08-4270-4064-8103-1fece055e197@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 12 quoted lines
> diff --git a/t/unit-tests/t-strvec.c b/t/unit-tests/t-strvec.c
> index fdb28ba220..6a4d425840 100644
> --- a/t/unit-tests/t-strvec.c
> +++ b/t/unit-tests/t-strvec.c
> @@ -8,7 +8,9 @@
> if (check_uint(ARRAY_SIZE(expect), >, 0) && \
> check_pointer_eq(expect[ARRAY_SIZE(expect) - 1], NULL) && \
> check_uint((vec)->nr, ==, ARRAY_SIZE(expect) - 1) && \
> - check_uint((vec)->nr, <=, (vec)->alloc)) { \
> + ((vec)->v == empty_strvec ? \
> + check_uint((vec)->nr, ==, (vec)->alloc) : \
> + check_uint((vec)->nr, <, (vec)->alloc))) { \Not a huge deal but with empty_strvec, don't we want to barf if nr==alloc==1?
Show 5 quoted lines
> for (size_t i = 0; i < ARRAY_SIZE(expect); i++) { \
> if (!check_str((vec)->v[i], expect[i])) { \
> test_msg(" i: %"PRIuMAX, i); \
> --
> 2.45.2