From: Collin Funk Date: Sat, 18 Oct 2025 03:04:59 +0000 (-0700) Subject: savedir tests: Check the length of the file names. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc638bf0bc5e2a8feab88326116aa36d23e7da25;p=thirdparty%2Fgnulib.git savedir tests: Check the length of the file names. Suggested by Bruno Haible in . * tests/test-savedir.c (test_savedir_sort_none) (test_savedir_sort_name): Check that the file names are only one character long. --- diff --git a/ChangeLog b/ChangeLog index c111b6214a..ebb923c842 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2025-10-17 Collin Funk + savedir tests: Check the length of the file names. + Suggested by Bruno Haible in + . + * tests/test-savedir.c (test_savedir_sort_none) + (test_savedir_sort_name): Check that the file names are only one + character long. + savedir: Add tests. * tests/test-savedir.c: New file. * modules/savedir-tests: Likewise. diff --git a/tests/test-savedir.c b/tests/test-savedir.c index 5b7e8401ee..1e58e8beaf 100644 --- a/tests/test-savedir.c +++ b/tests/test-savedir.c @@ -47,6 +47,7 @@ test_savedir_sort_none (void) for (char *namep = name_space; *namep != '\0'; namep += strlen (namep) + 1) { int index = *namep - 'a'; + ASSERT (strlen (namep) == 1); ASSERT (index < sizeof seen); seen[index] = true; } @@ -68,7 +69,10 @@ test_savedir_sort_name (void) /* Check that files "a" to "z" appear in order. */ for (char *namep = name_space; *namep != '\0'; namep += strlen (namep) + 1, i += 1) - ASSERT (*namep - 'a' == i); + { + ASSERT (strlen (namep) == 1); + ASSERT (*namep - 'a' == i); + } /* Make sure no extra files were seen. */ ASSERT (i == ('z' - 'a') + 1);