From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Achu Luma <ach.lumap@gmail.com>,
git@vger.kernel.org, chriscool@tuxfamily.org,
christian.couder@gmail.com, phillip.wood@dunelm.org.uk,
steadmon@google.com
Subject: Re: [Outreachy][PATCH v3] Port helper/test-ctype.c to unit-tests/t-ctype.c
Date: Tue, 02 Jan 2024 08:35:29 -0800 [thread overview]
Message-ID: <xmqqbka3g0by.fsf@gitster.g> (raw)
In-Reply-To: <435a03c7-dbf3-4ddb-b183-cac86ed0467d@web.de> (=?utf-8?Q?=22R?= =?utf-8?Q?en=C3=A9?= Scharfe"'s message of "Mon, 1 Jan 2024 17:41:06 +0100")
René Scharfe <l.s.r@web.de> writes:
>> ...
>> + for (int i = 0; i < 256; i++) { \
>> + if (!check_int(func(i), ==, is_in(string, i))) \
>> + test_msg(" i: %02x", i); \
>> + } \
>
> This loop is indented with spaces followed by tabs. The Git project
> prefers indenting by tabs and in some cases tabs followed by spaces, but
> not the other way array. git am warns about such whitespace errors and
> can actually fix them automatically, so I imagine this wouldn't be a
> deal breaker. But even if it seems picky, respecting the project's
> preferences from the start reduces unnecessary friction.
>
> The original test reported the number of a misclassified character
> (basically its ASCII code) in both decimal and hexadecimal form. This
> code prints it only in hexadecimal, but without the prefix "0x". A
> casual reader could mistake hexadecimal numbers for decimal ones as a
> result. Printing only one suffices, but I think it's better to either
> use decimal notation without any prefix or hexadecimal with the "0x"
> prefix to avoid confusion. There's no reason to be stingy with the
> screen space here.
> ...
> Each class (e.g. space or digit) is mentioned thrice here: When
> declaring its function with TEST_CTYPE_FUNC, when calling said function
> and again in the test description. Adding a new class requires adding
> two lines of code. That's not too bad, but the original implementation
> didn't require that repetition and adding a new class only required
> adding a single line.
Thanks for an excellent review.
>
> I mentioned this briefly in my review of v1 in
> https://lore.kernel.org/git/f743b473-40f8-423d-bf5b-d42b92e5aa1b@web.de/
> and showed a way to define character classes without repeating their
> names. You don't have to follow that suggestion, but it would be nice
> if you could give some feedback about it.
>
>> +
>> + return test_done();
>> +}
>
> René
next prev parent reply other threads:[~2024-01-02 16:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 23:15 [PATCH] Port helper/test-ctype.c to unit-tests/t-ctype.c Achu Luma
2023-12-26 18:45 ` Junio C Hamano
2023-12-27 10:57 ` Christian Couder
2023-12-27 11:57 ` René Scharfe
2023-12-27 14:40 ` Phillip Wood
2023-12-27 23:48 ` Junio C Hamano
2023-12-28 16:05 ` René Scharfe
2024-01-02 18:55 ` Taylor Blau
2023-12-30 0:09 ` [Outreachy][PATCH v2] " Achu Luma
2024-01-01 10:40 ` [Outreachy][PATCH v3] " Achu Luma
2024-01-01 16:41 ` René Scharfe
2024-01-02 16:35 ` Junio C Hamano [this message]
2024-01-05 16:14 ` [Outreachy][PATCH v4] " Achu Luma
2024-01-07 12:45 ` René Scharfe
2024-01-08 22:32 ` Junio C Hamano
2024-01-09 10:35 ` Phillip Wood
2024-01-09 17:12 ` Junio C Hamano
2024-01-12 10:27 ` [Outreachy][PATCH v5] " Achu Luma
2024-01-15 10:39 ` Phillip Wood
2024-01-16 15:38 ` Junio C Hamano
2024-01-16 19:27 ` René Scharfe
2024-01-16 19:45 ` Christian Couder
2024-01-16 19:52 ` Junio C Hamano
2024-01-17 5:37 ` Josh Steadmon
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=xmqqbka3g0by.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ach.lumap@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=phillip.wood@dunelm.org.uk \
--cc=steadmon@google.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).