2025-10-17 Collin Funk <collin.funk1@gmail.com>
+ savedir tests: Check the length of the file names.
+ Suggested by Bruno Haible in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2025-10/msg00049.html>.
+ * 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.
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;
}
/* 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);