]> Savannah Git Hosting - gnulib.git/commitdiff
mbrtowc: Add more tests.
authorBruno Haible <bruno@clisp.org>
Fri, 3 Jan 2020 00:23:24 +0000 (01:23 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 3 Jan 2020 00:23:24 +0000 (01:23 +0100)
* 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.

ChangeLog
modules/mbrtowc-tests
tests/test-mbrtowc-w32-6.sh
tests/test-mbrtowc-w32-7.sh
tests/test-mbrtowc-w32.c

index 6c71b813677d1b41fb752f52d3425c970134b224..1eb44197db4585bb242b3cceda65d937ced5115c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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).
index 86008d867d76efd544508796d83327427c60ce62..f5c9166f1d26920396476fb06c423fab9fe9881c 100644 (file)
@@ -10,6 +10,8 @@ tests/test-mbrtowc-w32-2.sh
 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
@@ -22,6 +24,7 @@ Depends-on:
 mbsinit
 wctob
 setlocale
+localcharset
 
 configure.ac:
 gt_LOCALE_FR
@@ -34,7 +37,8 @@ TESTS += \
   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@' \
index e608233caa23070cd00b4a36a42e789db982735f..c2e8dfe08173942e2bffcd36ba044904aa960519 100755 (executable)
@@ -1,7 +1,4 @@
 #!/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
index 0a3eb8f59ba36191af162fcf9197554fbe092d6e..2c5d555f1b7293100982c6cf4e388e523e89586f 100755 (executable)
@@ -1,7 +1,4 @@
 #!/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
index efeee15ace842308f501eaea8a154f151c8a5113..17908ed607da6de5c0bf71a8cdbd0c57dc9c86a2 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "localcharset.h"
 #include "macros.h"
 
 #if defined _WIN32 && !defined __CYGWIN__
@@ -476,6 +477,8 @@ test_one_locale (const char *name, int codepage)
 
     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));
@@ -572,6 +575,8 @@ test_one_locale (const char *name, int codepage)
 
     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));