From b0672d4868d2a2e19f031630cf72005dd26325f3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 25 Jul 2024 23:45:23 +0200 Subject: [PATCH] xstrtol, xstrtoll tests: Avoid test failure on FreeBSD. * tests/test-xstrtol.c (main): Adjust expected results for FreeBSD. --- ChangeLog | 3 +++ tests/test-xstrtol.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index e1f849e82c..21b1840dec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2024-07-25 Bruno Haible + 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 in . diff --git a/tests/test-xstrtol.c b/tests/test-xstrtol.c index f83d41905f..13ee24219b 100644 --- a/tests/test-xstrtol.c +++ b/tests/test-xstrtol.c @@ -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; -- 2.39.5