diff mbox series

[3/6] t-ctype: use TEST_RUN

Message ID abb96bfc-ed97-4c8e-a99a-0dadce45398e@web.de (mailing list archive)
State New
Headers show
Series unit-tests: add and use TEST_RUN to simplify tests | expand

Commit Message

René Scharfe June 29, 2024, 3:44 p.m. UTC
Use the macro TEST_RUN instead of the internal functions
test__run_begin() and test__run_end().

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 t/unit-tests/t-ctype.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--
2.45.2

Comments

Josh Steadmon July 1, 2024, 7:49 p.m. UTC | #1
On 2024.06.29 17:44, René Scharfe wrote:
> Use the macro TEST_RUN instead of the internal functions
> test__run_begin() and test__run_end().
> 
> Signed-off-by: René Scharfe <l.s.r@web.de>

Nitpick: please expand the commit message here as you did for the
following patches.
René Scharfe July 1, 2024, 8:04 p.m. UTC | #2
Am 01.07.24 um 21:49 schrieb Josh Steadmon:
> On 2024.06.29 17:44, René Scharfe wrote:
>> Use the macro TEST_RUN instead of the internal functions
>> test__run_begin() and test__run_end().
>>
>> Signed-off-by: René Scharfe <l.s.r@web.de>
>
> Nitpick: please expand the commit message here as you did for the
> following patches.

There is not much more to it: Use of internal functions is discouraged,
so this patch replaces their calls with the new public feature.  Perhaps
a "Kinda-requested-by: Phillip Wood <phillip.wood@dunelm.org.uk>" would
be appropriate?

Unlike in the later patches the tests themselves are unchanged, so this
has no consequence for people that want to add or modify character
classifier tests.

René
diff mbox series

Patch

diff --git a/t/unit-tests/t-ctype.c b/t/unit-tests/t-ctype.c
index d6ac1fe678..04a66dc105 100644
--- a/t/unit-tests/t-ctype.c
+++ b/t/unit-tests/t-ctype.c
@@ -4,15 +4,13 @@ 
 	size_t len = ARRAY_SIZE(string) - 1 + \
 		BUILD_ASSERT_OR_ZERO(ARRAY_SIZE(string) > 0) + \
 		BUILD_ASSERT_OR_ZERO(sizeof(string[0]) == sizeof(char)); \
-	int skip = test__run_begin(); \
-	if (!skip) { \
+	if (TEST_RUN(#class " works")) { \
 		for (int i = 0; i < 256; i++) { \
 			if (!check_int(class(i), ==, !!memchr(string, i, len)))\
 				test_msg("      i: 0x%02x", i); \
 		} \
 		check(!class(EOF)); \
 	} \
-	test__run_end(!skip, TEST_LOCATION(), #class " works"); \
 } while (0)

 #define DIGIT "0123456789"