From: "René Scharfe" <l.s.r@web.de>
To: Jeff King <peff@peff.net>
Cc: Git List <git@vger.kernel.org>, Patrick Steinhardt <ps@pks.im>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH v2] t-strvec: use test_msg()
Date: Sun, 14 Jul 2024 12:17:09 +0200 [thread overview]
Message-ID: <442b692d-a51b-4f45-a131-a44ac08c431b@web.de> (raw)
In-Reply-To: <20240709113201.GA994226@coredump.intra.peff.net>
Am 09.07.24 um 13:32 schrieb Jeff King:
> On Fri, Jul 05, 2024 at 07:03:36PM +0200, René Scharfe wrote:
>
>> diff --git a/t/unit-tests/t-strvec.c b/t/unit-tests/t-strvec.c
>> index d4615ab06d..236203af61 100644
>> --- a/t/unit-tests/t-strvec.c
>> +++ b/t/unit-tests/t-strvec.c
>> @@ -17,12 +17,12 @@ static void check_strvec_loc(const char *loc, struct strvec *vec, ...)
>> break;
>>
>> if (!check_uint(vec->nr, >, nr) ||
>> - !check_uint(vec->alloc, >, nr) ||
>> - !check_str(vec->v[nr], str)) {
>> - struct strbuf msg = STRBUF_INIT;
>> - strbuf_addf(&msg, "strvec index %"PRIuMAX, (uintmax_t) nr);
>> - test_assert(loc, msg.buf, 0);
>> - strbuf_release(&msg);
>> + !check_uint(vec->alloc, >, nr)) {
>> + va_end(ap);
>> + return;
>> + }
>> + if (!check_str(vec->v[nr], str)) {
>> + test_msg(" nr: %"PRIuMAX, (uintmax_t)nr);
>> va_end(ap);
>> return;
>> }
>
> The "loc" parameter to the function is now unused. Should it be removed,
> or is it a bug that we are no longer reporting the caller's location?
It's a bug. If only there was a way to detect such an unused parameter
automatically.. ;->
> Should we be using check_str_loc() in the post-image?
Yes, and check_uint_loc() and check_pointer_eq_loc() as well. Which
would be a pain. Or we drag everything into the macro check_strvec and
get the caller's line number for free.
René
next prev parent reply other threads:[~2024-07-14 10:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 18:04 [PATCH] t-strvec: use test_msg() René Scharfe
2024-07-04 18:31 ` Eric Sunshine
2024-07-05 9:44 ` Phillip Wood
2024-07-05 17:03 ` [PATCH v2] " René Scharfe
2024-07-09 11:32 ` Jeff King
2024-07-14 10:17 ` René Scharfe [this message]
2024-07-16 1:43 ` Jeff King
2024-07-16 16:43 ` René Scharfe
2024-07-14 17:06 ` [PATCH v2 2/1] t-strvec: improve check_strvec() output René Scharfe
2024-07-15 14:44 ` Junio C Hamano
2024-07-14 17:06 ` [PATCH v2 3/1] t-strvec: tighten .alloc check in check_strvec René Scharfe
2024-07-15 14:43 ` Junio C Hamano
2024-07-15 16:47 ` René Scharfe
2024-07-15 17:27 ` Junio C Hamano
2024-07-14 10:17 ` [PATCH v3] t-strvec: improve check_strvec() output René Scharfe
2024-07-14 17:06 ` René Scharfe
2024-07-16 4:37 ` Jeff King
2024-07-16 15:20 ` Junio C Hamano
2024-07-16 16:14 ` [PATCH] t-strvec: fix type mismatch in check_strvec René Scharfe
2024-07-16 16: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=442b692d-a51b-4f45-a131-a44ac08c431b@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
--cc=sunshine@sunshineco.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;
as well as URLs for NNTP newsgroup(s).