]> Savannah Git Hosting - gnulib.git/commitdiff
strsignal-tests: Fix test failure on macOS 10.13.
authorBruno Haible <bruno@clisp.org>
Wed, 2 Dec 2020 21:30:10 +0000 (22:30 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 2 Dec 2020 21:30:10 +0000 (22:30 +0100)
Reported by Martin Storsjö <martin@martin.st> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00003.html>.

* tests/test-strsignal.c (ASSERT_DESCRIPTION): Allow the actual result
to be longer than the expected result.

ChangeLog
tests/test-strsignal.c

index ae48d2dcdb46188ab1a243097ac6088224102cd1..cbe4558d53cf20592a1767e35720147c79166004 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-12-02  Bruno Haible  <bruno@clisp.org>
+
+       strsignal-tests: Fix test failure on macOS 10.13.
+       Reported by Martin Storsjö <martin@martin.st> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00003.html>.
+       * tests/test-strsignal.c (ASSERT_DESCRIPTION): Allow the actual result
+       to be longer than the expected result.
+
 2020-12-02  Bruno Haible  <bruno@clisp.org>
 
        Fix compilation errors in test-math-c++.cc on FreeBSD 12.2/arm64.
index 0316d40fabb1f2577d6ea955344414f5e8a7fe79..1f8aeba1604246b7aa30d5963acade99d0453da5 100644 (file)
@@ -28,10 +28,12 @@ SIGNATURE_CHECK (strsignal, char *, (int));
 #include "macros.h"
 
 #if HAVE_DECL_SYS_SIGLIST
-# define ASSERT_DESCRIPTION(got, expect)
+# define ASSERT_DESCRIPTION(actual, expected)
 #else
-/* In this case, we can guarantee some signal descriptions.  */
-# define ASSERT_DESCRIPTION(got, expect) ASSERT (!strcmp (got, expect))
+/* 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)
 #endif
 
 int