* tests/test-mbrtowc-w32.c: Include localcharset.h.
(test_one_locale): For the GB18030 and UTF-8 tests, verify that
locale_charset() returns the expected value; otherwise, skip the test.
* tests/test-mbrtowc-w32-6.sh: Remove old comment.
* tests/test-mbrtowc-w32-7.sh: Likewise.
* modules/mbrtowc-tests (Files): Add these files.
(Depends-on): Add localcharset.
(TESTS): Add test-mbrtowc-w32-6.sh, test-mbrtowc-w32-7.sh.
+2020-01-02 Bruno Haible <bruno@clisp.org>
+
+ mbrtowc: Add more tests.
+ * tests/test-mbrtowc-w32.c: Include localcharset.h.
+ (test_one_locale): For the GB18030 and UTF-8 tests, verify that
+ locale_charset() returns the expected value; otherwise, skip the test.
+ * tests/test-mbrtowc-w32-6.sh: Remove old comment.
+ * tests/test-mbrtowc-w32-7.sh: Likewise.
+ * modules/mbrtowc-tests (Files): Add these files.
+ (Depends-on): Add localcharset.
+ (TESTS): Add test-mbrtowc-w32-6.sh, test-mbrtowc-w32-7.sh.
+
2020-01-02 Bruno Haible <bruno@clisp.org>
mbrtowc: Fix test failures on MSVC (regression by previous commit).
tests/test-mbrtowc-w32-3.sh
tests/test-mbrtowc-w32-4.sh
tests/test-mbrtowc-w32-5.sh
+tests/test-mbrtowc-w32-6.sh
+tests/test-mbrtowc-w32-7.sh
tests/test-mbrtowc-w32.c
tests/signature.h
tests/macros.h
mbsinit
wctob
setlocale
+localcharset
configure.ac:
gt_LOCALE_FR
test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh \
test-mbrtowc5.sh \
test-mbrtowc-w32-1.sh test-mbrtowc-w32-2.sh test-mbrtowc-w32-3.sh \
- test-mbrtowc-w32-4.sh test-mbrtowc-w32-5.sh
+ test-mbrtowc-w32-4.sh test-mbrtowc-w32-5.sh test-mbrtowc-w32-6.sh \
+ test-mbrtowc-w32-7.sh
TESTS_ENVIRONMENT += \
LOCALE_FR='@LOCALE_FR@' \
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
#!/bin/sh
-# This test is not enabled by default, because MSVCRT does not support and
-# will likely never support locales with MB_CUR_MAX > 2.
-
# Test a GB18030 locale.
${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_China 54936
#!/bin/sh
-# This test is not enabled by default, because MSVCRT does not support and
-# will likely never support locales with MB_CUR_MAX > 2.
-
# Test some UTF-8 locales.
${CHECKER} ./test-mbrtowc-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
#include <stdlib.h>
#include <string.h>
+#include "localcharset.h"
#include "macros.h"
#if defined _WIN32 && !defined __CYGWIN__
case 54936:
/* Locale encoding is CP54936 = GB18030. */
+ if (strcmp (locale_charset (), "GB18030") != 0)
+ return 77;
{
char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
memset (&state, '\0', sizeof (mbstate_t));
case 65001:
/* Locale encoding is CP65001 = UTF-8. */
+ if (strcmp (locale_charset (), "UTF-8") != 0)
+ return 77;
{
char input[] = "B\303\274\303\237er"; /* "Büßer" */
memset (&state, '\0', sizeof (mbstate_t));