]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t-ctype: simplify EOF check
authorRené Scharfe <l.s.r@web.de>
Sun, 3 Mar 2024 10:13:26 +0000 (11:13 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Mar 2024 17:47:33 +0000 (09:47 -0800)
EOF is not a member of any character class.  If a classifier function
returns a non-zero result for it, presumably by mistake, then the unit
test check reports:

   # check "!iseof(EOF)" failed at t/unit-tests/t-ctype.c:53
   #       i: 0xffffffff (EOF)

The numeric value of EOF is not particularly interesting in this
context.  Stop printing the second line.

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

index 35473c41d87b30e385d94ddec6aa3d5e276053b7..f0d61d6eb26342423e9fe0981ca0befb89c19bb8 100644 (file)
@@ -10,8 +10,7 @@ static void test_ctype_##func(void) { \
                if (!check_int(func(i), ==, !!memchr(string, i, len))) \
                        test_msg("       i: 0x%02x", i); \
        } \
-       if (!check(!func(EOF))) \
-                       test_msg("      i: 0x%02x (EOF)", EOF); \
+       check(!func(EOF)); \
 }
 
 #define TEST_CHAR_CLASS(class) TEST(test_ctype_##class(), #class " works")