bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mbrtowc tests: don't make assumptions about the charset the C locale


From: Bruno Haible
Subject: Re: mbrtowc tests: don't make assumptions about the charset the C locale
Date: Sun, 25 Feb 2018 01:59:29 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-112-generic; KDE/5.18.0; x86_64; ; )

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  <address@hidden>

        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

[Prev in Thread] Current Thread [Next in Thread]