Message ID | abb96bfc-ed97-4c8e-a99a-0dadce45398e@web.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | unit-tests: add and use TEST_RUN to simplify tests | expand |
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.
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é
Hi René On 01/07/2024 21:04, René Scharfe wrote: > 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? Perhaps something like These tests use the internal functions test__run_begin() and test__run_end() which are supposed to be private to the test framework. Convert them to use the newly added TEST_RUN() instead. would be sufficient? Best Wishes Phillip > 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é
Am 02.07.24 um 17:14 schrieb phillip.wood123@gmail.com: > Hi René > > On 01/07/2024 21:04, René Scharfe wrote: >> 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? > > Perhaps something like > > These tests use the internal functions test__run_begin() and > test__run_end() which are supposed to be private to the test > framework. Convert them to use the newly added TEST_RUN() instead. > would be sufficient? That works for me. René
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"
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