From: Junio C Hamano <gitster@pobox.com>
To: Amisha Chhajed <amishhhaaaa@gmail.com>
Cc: Derrick Stolee <stolee@gmail.com>,
Elijah Newren <newren@gmail.com>, Jeff King <peff@peff.net>,
git@vger.kernel.org
Subject: Re: [PATCH 1/2] u-string-list: add unit tests for string-list methods
Date: Sun, 25 Jan 2026 23:12:27 -0800 [thread overview]
Message-ID: <xmqqpl6wkftw.fsf@gitster.g> (raw)
In-Reply-To: <20260125201500.63904-1-amishhhaaaa@gmail.com> (Amisha Chhajed's message of "Mon, 26 Jan 2026 01:44:59 +0530")
Amisha Chhajed <amishhhaaaa@gmail.com> writes:
> Unit tests in u-string-list.c does not cover several methods
> in string-list, this gap in coverage makes it difficult to
> ensure no regressions are introduced in future changes.
>
> Add unit tests for the following methods to enhance coverage:
> string_list_remove_empty_items()
> unsorted_string_list_has_string()
> unsorted_string_list_delete_item()
> string_list_has_string()
> string_list_insert()
> string_list_sort()
> string_list_remove()
>
> Signed-off-by: Amisha Chhajed <amishhhaaaa@gmail.com>
> ---
> t/unit-tests/u-string-list.c | 197 +++++++++++++++++++++++++++++++++++
> 1 file changed, 197 insertions(+)
>
> diff --git a/t/unit-tests/u-string-list.c b/t/unit-tests/u-string-list.c
> index a2457d7b1e..6b4b858330 100644
> --- a/t/unit-tests/u-string-list.c
> +++ b/t/unit-tests/u-string-list.c
> @@ -243,6 +243,133 @@ void test_string_list__filter(void)
> ...
> +static void t_string_list_insert(struct string_list *expected_strings, ...)
> +{
> + struct string_list strings_to_insert = STRING_LIST_INIT_DUP;
> + struct string_list list = STRING_LIST_INIT_DUP;
> + va_list ap;
> +
> + va_start(ap, expected_strings);
> + t_vcreate_string_list_dup(&strings_to_insert, 0, ap);
> + va_end(ap);
> +
> + for (int i = 0; i < strings_to_insert.nr; i++) {
As strings_to_insert.nr is of type size_t, even though int is plenty
large enough in practice, the compiler will complain.
> + string_list_insert(&list, strings_to_insert.items[i].string);
> + }
Also, lose the {} around a single statement block.
next prev parent reply other threads:[~2026-01-26 7:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 17:15 [RFC PATCH 0/2] Adding string_list_sort_u to replace combined calls of string_list_sort and string_list_remove_duplicates calls Amisha Chhajed
2026-01-22 17:15 ` [RFC PATCH 1/2] Adding string_list_sort_u which sorts a list then deduplicates it Amisha Chhajed
2026-01-22 22:07 ` Junio C Hamano
2026-01-25 20:23 ` Amisha Chhajed
2026-01-22 17:15 ` [RFC PATCH 2/2] Replacing calls of string_list_sort and string_list_remove_duplicates with the combined variant string_list_u Amisha Chhajed
2026-01-22 22:19 ` Junio C Hamano
2026-01-22 22:09 ` [RFC PATCH 0/2] Adding string_list_sort_u to replace combined calls of string_list_sort and string_list_remove_duplicates calls Junio C Hamano
2026-01-25 20:14 ` [PATCH 1/2] u-string-list: add unit tests for string-list methods Amisha Chhajed
2026-01-25 20:15 ` [PATCH 2/2] string-list: add string_list_sort_u() that mimics "sort -u" Amisha Chhajed
2026-01-29 12:12 ` [PATCH v3 1/2] u-string-list: add unit tests for string-list methods Amisha Chhajed
2026-01-29 12:12 ` [PATCH v3 2/2] string-list: add string_list_sort_u() that mimics "sort -u" Amisha Chhajed
2026-01-29 12:14 ` [PATCH v3 1/2] u-string-list: add unit tests for string-list methods Amisha Chhajed
2026-01-30 19:51 ` [PATCH 2/2] string-list: add string_list_sort_u() that mimics "sort -u" Kristoffer Haugsbakk
2026-01-30 21:45 ` Junio C Hamano
2026-01-26 7:12 ` Junio C Hamano [this message]
2026-01-26 18:57 ` [PATCH 1/2] u-string-list: add unit tests for string-list methods Amisha Chhajed
2026-01-26 19:12 ` Junio C Hamano
2026-01-25 20:17 ` Amisha Chhajed
2026-01-25 20:17 ` [PATCH 2/2] string-list: add string_list_sort_u() that mimics "sort -u" Amisha Chhajed
2026-01-26 18:56 ` [PATCH v2 1/2] u-string-list: add unit tests for string-list methods Amisha Chhajed
2026-01-26 18:56 ` [PATCH v2 2/2] string-list: add string_list_sort_u() that mimics "sort -u" Amisha Chhajed
2026-01-26 20:11 ` Junio C Hamano
2026-01-27 1:27 ` Amisha Chhajed
2026-01-26 19:50 ` [PATCH v2 1/2] u-string-list: add unit tests for string-list methods Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqpl6wkftw.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=amishhhaaaa@gmail.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox