]> git.ipfire.org Git - thirdparty/git.git/commit
t-ctype: avoid duplicating class names
authorRené Scharfe <l.s.r@web.de>
Sun, 3 Mar 2024 10:13:28 +0000 (11:13 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Mar 2024 17:47:33 +0000 (09:47 -0800)
commit6cf06e9c6e9b4e99fc5abb334172cc201a42d66b
tree3d892db0c8a80b8c479a37dbcfc936d9b35b49a2
parent7a8d6c0a10e836d47e5531e321b5e1a944aa6123
t-ctype: avoid duplicating class names

TEST_CTYPE_FUNC defines a function for testing a character classifier,
TEST_CHAR_CLASS calls it, causing the class name to be mentioned twice.

Avoid the need to define a class-specific function by letting
TEST_CHAR_CLASS do all the work.  This is done by using the internal
functions test__run_begin() and test__run_end(), but they do exist to be
used in test macros after all.

Alternatively we could unroll the loop to provide a very long expression
that tests all 256 characters and EOF and hand that to TEST, but that
seems awkward and hard to read.

No change of behavior or output intended.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/t-ctype.c