Bernhard Voelker wrote:
> Now this test fails on GNU/Linux - at least here on openSUSE-Tumbleweed.
> 
> FAIL: test-mbrtowc5.sh
> ======================
> 
> test-mbrtowc.c:114: assertion 'wc == btowc (c)' failed
> ./test-mbrtowc5.sh: line 4: 21847 Aborted                 (core dumped) 
> LC_ALL=C ./test-mbrtowc${EXEEXT} 5
> FAIL test-mbrtowc5.sh (exit status: 134)

Oops. Thanks for the rapid notice. This patch fixes it. This time, I've
tested it on glibc, musl, Mac OS X, FreeBSD, NetBSD, OpenBSD, AIX, HP-UX,
IRIX, Solaris, Cygwin.


2018-02-24  Bruno Haible  <br...@clisp.org>

        mbrtowc tests: Fix regression on glibc.
        Reported by Bernhard Voelker.
        * tests/test-mbrtowc.c (main): Fix expected value of wc.

diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c
index 54d52f8..44da295 100644
--- a/tests/test-mbrtowc.c
+++ b/tests/test-mbrtowc.c
@@ -111,7 +111,7 @@ main (int argc, char *argv[])
                locale.
                On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
                But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  
*/
-            ASSERT (wc == btowc (c));
+            ASSERT (wc == (btowc (c) == WEOF ? c : btowc (c)));
           ASSERT (mbsinit (&state));
           ret = mbrtowc (NULL, buf, 1, &state);
           ASSERT (ret == 1);


Reply via email to