* tests/test-environ.c (main): Use str_startswith.
* tests/test-getprogname.c (main): Likewise.
* tests/test-libtextstyle.c (main): Likewise.
* tests/test-strsignal.c (ASSERT_DESCRIPTION): Likewise.
* modules/environ-tests (Depends-on): Add str_startswith.
* modules/getprogname-tests (Depends-on): Likewise.
* modules/libtextstyle-optional-tests (Depends-on): Likewise.
* modules/strsignal-tests (Depends-on): Likewise.
2025-01-03 Bruno Haible <bruno@clisp.org>
+ tests: Use str_startswith.
+ * tests/test-environ.c (main): Use str_startswith.
+ * tests/test-getprogname.c (main): Likewise.
+ * tests/test-libtextstyle.c (main): Likewise.
+ * tests/test-strsignal.c (ASSERT_DESCRIPTION): Likewise.
+ * modules/environ-tests (Depends-on): Add str_startswith.
+ * modules/getprogname-tests (Depends-on): Likewise.
+ * modules/libtextstyle-optional-tests (Depends-on): Likewise.
+ * modules/strsignal-tests (Depends-on): Likewise.
+
git-merge-changelog, gen-uni-tables: Use str_startswith.
* lib/git-merge-changelog.c (main): Use str_startswith.
* lib/gen-uni-tables.c (output_predicate, is_property_composite,
tests/test-environ.c
Depends-on:
+str_startswith
configure.ac:
Depends-on:
string-h
+str_startswith
configure.ac:
Depends-on:
c99
isatty
+str_startswith
configure.ac:
gl_LIBTEXTSTYLE_OPTIONAL
tests/macros.h
Depends-on:
+str_startswith
configure.ac:
for (; (string = *remaining_variables) != NULL; remaining_variables++)
{
- if (strncmp (string, "PATH=", 5) == 0)
+ if (str_startswith (string, "PATH="))
/* Found the PATH environment variable. */
return 0;
}
with "lt-" (depends on the platform). But the name of the temporary
executable is a detail that should not be visible to the end user and to
the test suite. Remove this "lt-" prefix here. */
- if (strncmp (p, "lt-", 3) == 0)
+ if (str_startswith (p, "lt-"))
p += 3;
/* Note: You can make this test fail
for (i = 1; i < argc; i++)
{
const char *arg = argv[i];
- if (strncmp (arg, "--color=", 8) == 0)
+ if (str_startswith (arg, "--color="))
handle_color_option (arg + 8);
- else if (strncmp (arg, "--style=", 8) == 0)
+ else if (str_startswith (arg, "--style="))
handle_style_option (arg + 8);
else if (arg[0] == '-')
{
/* In this case, we can guarantee some signal descriptions.
But allow the actual result to be longer than the expected result. */
# define ASSERT_DESCRIPTION(actual, expected) \
- ASSERT (strncmp (actual, expected, strlen (expected)) == 0)
+ ASSERT (str_startswith (actual, expected))
#endif
int