From: Patrick Steinhardt <ps@pks.im>
To: Chandra Pratap <chandrapratap3519@gmail.com>
Cc: git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [GSoC][PATCH v2 3/4] t: move tests from reftable/record_test.c to the new unit test
Date: Wed, 29 May 2024 11:30:03 +0200 [thread overview]
Message-ID: <Zlb1m5cwhW_R5EzP@tanuki> (raw)
In-Reply-To: <20240529070341.4248-4-chandrapratap3519@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]
On Wed, May 29, 2024 at 12:25:11PM +0530, Chandra Pratap wrote:
[snip]
> diff --git a/t/unit-tests/t-reftable-basics.c b/t/unit-tests/t-reftable-basics.c
> index 55fcff12d9..b02ca02040 100644
> --- a/t/unit-tests/t-reftable-basics.c
> +++ b/t/unit-tests/t-reftable-basics.c
> @@ -99,13 +99,38 @@ static void test_parse_names_drop_empty(void)
>
> static void test_common_prefix(void)
> {
> - struct strbuf s1 = STRBUF_INIT;
> - struct strbuf s2 = STRBUF_INIT;
> - strbuf_addstr(&s1, "abcdef");
> - strbuf_addstr(&s2, "abc");
> - check_int(common_prefix_size(&s1, &s2), ==, 3);
> - strbuf_release(&s1);
> - strbuf_release(&s2);
> + struct strbuf a = STRBUF_INIT;
> + struct strbuf b = STRBUF_INIT;
> + struct {
> + const char *a, *b;
> + int want;
> + } cases[] = {
> + {"abcdef", "abc", 3},
> + { "abc", "ab", 2 },
> + { "", "abc", 0 },
> + { "abc", "abd", 2 },
> + { "abc", "pqr", 0 },
> + };
> +
> + for (size_t i = 0; i < ARRAY_SIZE(cases); i++) {
> + strbuf_addstr(&a, cases[i].a);
> + strbuf_addstr(&b, cases[i].b);
> + check_int(common_prefix_size(&a, &b), ==, cases[i].want);
> + strbuf_reset(&a);
> + strbuf_reset(&b);
> + }
> + strbuf_release(&a);
> + strbuf_release(&b);
> +}
Oh, so this test was even duplicated. It may make sense to point out
details like this in the commit message to prepare the reader. But
that's probably not worth a reroll.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-05-29 9:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <--in-reply-to=20240528113856.8348-1-chandrapratap3519@gmail.com>
2024-05-29 6:55 ` [GSoC][PATCH v2 0/4] t: port reftable/basics_test.c to the unit testing Chandra Pratap
2024-05-29 6:55 ` [GSoC][PATCH v2 1/4] t: move reftable/basics_test.c to the unit testing framework Chandra Pratap
2024-05-29 6:55 ` [GSoC][PATCH v2 2/4] t: move tests from reftable/stack_test.c to the new unit test Chandra Pratap
2024-05-29 6:55 ` [GSoC][PATCH v2 3/4] t: move tests from reftable/record_test.c " Chandra Pratap
2024-05-29 9:30 ` Patrick Steinhardt [this message]
2024-05-29 22:38 ` Junio C Hamano
2024-05-29 6:55 ` [GSoC][PATCH v2 4/4] t: add test for put_be16() and improve test-case for parse_names() Chandra Pratap
2024-05-29 9:30 ` Patrick Steinhardt
2024-05-29 9:29 ` [GSoC][PATCH v2 0/4] t: port reftable/basics_test.c to the unit testing Patrick Steinhardt
2024-05-29 16:59 ` [GSoC][PATCH v3 " Chandra Pratap
2024-05-29 16:59 ` [GSoC][PATCH v3 1/5] t: move reftable/basics_test.c to the unit testing framework Chandra Pratap
2024-05-29 16:59 ` [GSoC][PATCH v3 2/5] t: move tests from reftable/stack_test.c to the new unit test Chandra Pratap
2024-05-29 16:59 ` [GSoC][PATCH v3 3/5] t: move tests from reftable/record_test.c " Chandra Pratap
2024-05-29 16:59 ` [GSoC][PATCH v3 4/5] t: add test for put_be16() Chandra Pratap
2024-05-29 16:59 ` [GSoC][PATCH v3 5/5] t: improve the test-case for parse_names() Chandra Pratap
2024-05-30 4:35 ` [GSoC][PATCH v3 0/4] t: port reftable/basics_test.c to the unit testing Patrick Steinhardt
2024-05-30 7:52 ` Christian Couder
2024-05-30 14:33 ` 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=Zlb1m5cwhW_R5EzP@tanuki \
--to=ps@pks.im \
--cc=chandrapratap3519@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).