From: Bruno Haible Date: Sat, 25 Jan 2020 19:45:03 +0000 (+0100) Subject: iswdigit tests: Avoid test failure on Cygwin. X-Git-Tag: v1.0~4322 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7aebcc2d9db10d1611a611ea44f51c003c867f03;p=gnulib.git iswdigit tests: Avoid test failure on Cygwin. * tests/test-iswdigit.c (for_character): If mbrtowc cannot convert the byte sequence, return 0. --- diff --git a/ChangeLog b/ChangeLog index a541c4480b..2a1fdd6842 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-01-25 Bruno Haible + iswdigit tests: Avoid test failure on Cygwin. + * tests/test-iswdigit.c (for_character): If mbrtowc cannot convert the + byte sequence, return 0. + iswdigit: Fix test failure on native Windows. * lib/wctype.in.h (rpl_iswdigit): Rely on ISO C compliant definition. diff --git a/tests/test-iswdigit.c b/tests/test-iswdigit.c index 5bfe2a4327..a7f8ef5813 100644 --- a/tests/test-iswdigit.c +++ b/tests/test-iswdigit.c @@ -39,9 +39,10 @@ for_character (const char *s, size_t n) memset (&state, '\0', sizeof (mbstate_t)); wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, s, n, &state); - ASSERT (ret == n); - - return iswdigit (wc); + if (ret == n) + return iswdigit (wc); + else + return 0; } int