]> Savannah Git Hosting - gnulib.git/commitdiff
xstrtol, xstrtoll tests: Avoid test failure on FreeBSD.
authorBruno Haible <bruno@clisp.org>
Thu, 25 Jul 2024 21:45:23 +0000 (23:45 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 25 Jul 2024 21:45:23 +0000 (23:45 +0200)
* tests/test-xstrtol.c (main): Adjust expected results for FreeBSD.

ChangeLog
tests/test-xstrtol.c

index e1f849e82cf8374d06f8518bc7fc335bf76c07c7..21b1840decca555105ff1917304aa241c304b47c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2024-07-25  Bruno Haible  <bruno@clisp.org>
 
+       xstrtol, xstrtoll tests: Avoid test failure on FreeBSD.
+       * tests/test-xstrtol.c (main): Adjust expected results for FreeBSD.
+
        xstrtol, xstrtoll tests: Test behaviour for an invalid base.
        Reported by Alejandro Colomar <alx@kernel.org> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00249.html>.
index f83d41905ff188cf99296d78fa2b72c6efd1d753..13ee24219bbc7522fdb6dc8dab254e4108b59cb6 100644 (file)
@@ -73,9 +73,15 @@ main (int argc, char **argv)
         char *endp = NULL;
         __strtol_t val = -17;
         strtol_error s_err = __xstrtol (input, &endp, -1, &val, "k");
+#if defined __FreeBSD__
+        ASSERT (s_err == LONGINT_OK);
+        ASSERT (endp == input + 1);
+        ASSERT (val == 1024);
+#else
         ASSERT (s_err == LONGINT_INVALID);
         ASSERT (endp == NULL);
         ASSERT (val == -17);
+#endif
       }
 
       return test_exit_status;