Hello,

These few patches make tests for C95 conversion functions more reliable on 
older Windows versions.

- Kirill Makurin
From 09797e44aeb9cb2f211cb0470093e1363301b1a8 Mon Sep 17 00:00:00 2001
From: Kirill Makurin <[email protected]>
Date: Wed, 8 Jul 2026 21:49:45 +0900
Subject: [PATCH 1/3] crt: tests: do not use code page 28591 in t_mbrtowc,
 t_wctob and t_wcrtomb

Code page 28591 (ISO-8859-1) is not always installed on pre-Vista systems.
Instead, use ANSI code page 1252.

Signed-off-by: Kirill Makurin <[email protected]>
---
 mingw-w64-crt/testcases/t_mbrtowc.c | 38 +++++++++++++++++++----
 mingw-w64-crt/testcases/t_wcrtomb.c | 47 ++++++++++++++++++++++++++---
 mingw-w64-crt/testcases/t_wctob.c   | 27 ++++++++++++++---
 3 files changed, 98 insertions(+), 14 deletions(-)

diff --git a/mingw-w64-crt/testcases/t_mbrtowc.c 
b/mingw-w64-crt/testcases/t_mbrtowc.c
index a8e28db77..03c36f600 100644
--- a/mingw-w64-crt/testcases/t_mbrtowc.c
+++ b/mingw-w64-crt/testcases/t_mbrtowc.c
@@ -87,23 +87,49 @@ int main (void) {
 
   /**
    * Test SBCS code page
-   * NOTE: Code page 28951 is ISO-8859-1
    */
-  assert (setlocale (LC_ALL, "English_United States.28591") != NULL);
+  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
-   * All bytes must be valid
-   *
-   * We test ISO-8859-1 so that all bytes must convert to themselves
+   * All bytes in range [0,127] are valid ASCII characters
    */
-  for (unsigned char c = 0;; ++c) {
+  for (unsigned char c = 0; c < 0x80; ++c) {
     wc = WEOF;
 
     assert (mbrtowc (&wc, (char *) &c, MB_CUR_MAX, &state) == !!c);
     assert (wc == c);
     assert (mbsinit (&state));
     assert (errno == 0);
+  }
+
+  /**
+   * All bytes in range [128,159] are valid characters
+   */
+  for (unsigned char c = 0x80; c < 0xA0; ++c) {
+    wc = WEOF;
+
+    assert (mbrtowc (&wc, (char *) &c, MB_CUR_MAX, &state) == 1);
+    if (c == 0x81 || c == 0x8D || c == 0x8F || c == 0x90 || c == 0x9D) {
+      assert (wc == c);
+    } else {
+      assert (wc != WEOF);
+      assert (wc != c);
+    }
+    assert (mbsinit (&state));
+    assert (errno == 0);
+  }
+
+  /**
+   * All bytes in range [160,255] are valid and must convert to themselves
+   */
+  for (unsigned char c = 0xA0;; ++c) {
+    wc = WEOF;
+
+    assert (mbrtowc (&wc, (char *) &c, MB_CUR_MAX, &state) == 1);
+    assert (wc == c);
+    assert (mbsinit (&state));
+    assert (errno == 0);
 
     if (c == 0xFF) {
       break;
diff --git a/mingw-w64-crt/testcases/t_wcrtomb.c 
b/mingw-w64-crt/testcases/t_wcrtomb.c
index bd49df454..b6a59f4c9 100644
--- a/mingw-w64-crt/testcases/t_wcrtomb.c
+++ b/mingw-w64-crt/testcases/t_wcrtomb.c
@@ -126,15 +126,54 @@ int main (void) {
 
   /**
    * Test SBCS code page
-   * NOTE: Code page 28951 is ISO-8859-1
    */
-  assert (setlocale (LC_ALL, "English_United States.28591") != NULL);
+  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
-   * All values in range [0,255] must convert to themselves
+   * All values in range [0,127] are valid ASCII characters
    */
-  for (wchar_t wc = 0; wc < 0x100; ++wc) {
+  for (wchar_t wc = 0; wc < 0x80; ++wc) {
+    char c = EOF;
+
+    assert (wcrtomb (&c, wc, &state) == 1);
+    assert ((unsigned char) c == wc);
+    assert (errno == 0);
+    assert (mbsinit (&state));
+  }
+
+  /**
+   * All values in range [128,159] are valid characters
+   */
+  for (wchar_t wc = 0x80; wc < 0xA0; ++wc) {
+    char c = EOF;
+
+    size_t length = wcrtomb (&c, wc, &state);
+    assert (length == 1 || length == (size_t) -1);
+
+    if (length == 1) {
+      if (wc == 0x81 || wc == 0x8D || wc == 0x8F || wc == 0x90 || wc == 0x9D) {
+        assert ((unsigned char) c == wc);
+      } else {
+        assert (c != EOF);
+        assert ((unsigned char) c != wc);
+      }
+      assert (errno == 0);
+      assert (mbsinit (&state));
+    } else {
+      assert (c == EOF);
+      assert (errno == EILSEQ);
+      assert (mbsinit (&state));
+
+      // reset errno
+      _set_errno (0);
+    }
+  }
+
+  /**
+   * All values in range [160,255] are valid and must convert to themselves
+   */
+  for (wchar_t wc = 0xA0; wc < 0x100; ++wc) {
     char c = EOF;
 
     assert (wcrtomb (&c, wc, &state) == 1);
diff --git a/mingw-w64-crt/testcases/t_wctob.c 
b/mingw-w64-crt/testcases/t_wctob.c
index 953b1f0e9..15bc27d94 100644
--- a/mingw-w64-crt/testcases/t_wctob.c
+++ b/mingw-w64-crt/testcases/t_wctob.c
@@ -42,15 +42,34 @@ int main (void) {
 
   /**
    * Test SBCS code page
-   * NOTE: code page 28591 is ISO-8859-1
    */
-  assert (setlocale (LC_ALL, "English_United States.28591") != NULL);
+  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
-   * All values in range [0,255] are valid and must convert to themselves
+   * All values in range [0,127] are valid ASCII characters
    */
-  for (wchar_t wc = 0; wc < 0x100; ++wc) {
+  for (wchar_t wc = 0; wc < 0x80; ++wc) {
+    assert (wctob (wc) == wc);
+  }
+
+  /**
+   * All values in range [128,159] are valid characters
+   */
+  for (wchar_t wc = 0x80; wc < 0xA0; ++wc) {
+    int c = wctob (wc);
+
+    if (wc == 0x81 || wc == 0x8D || wc == 0x8F || wc == 0x90 || wc == 0x9D) {
+      assert ((unsigned char) c == wc);
+    } else {
+      assert (c == EOF || (unsigned char) c != wc);
+    }
+  }
+
+  /**
+   * All values in range [160,255] are valid and must convert to themselves
+   */
+  for (wchar_t wc = 0xA0; wc < 0x100; ++wc) {
     assert (wctob (wc) == wc);
   }
 
-- 
2.51.0.windows.1

From b51967766ff2653221792218920680235dafc2cd Mon Sep 17 00:00:00 2001
From: Kirill Makurin <[email protected]>
Date: Wed, 8 Jul 2026 21:49:45 +0900
Subject: [PATCH 2/3] crt: tests: do not hardcode locale strings

Using hardcoded locales makes tests less reliable on older Windows versions,
where requested locale may simply not be installed.

Function `setlocale` in all CRTs supports strings in ".CodePage" format;
this makes it use user default locale with specified code page.

Signed-off-by: Kirill Makurin <[email protected]>
---
 mingw-w64-crt/testcases/t_btowc.c     | 4 ++--
 mingw-w64-crt/testcases/t_mbrlen.c    | 4 ++--
 mingw-w64-crt/testcases/t_mbrtowc.c   | 4 ++--
 mingw-w64-crt/testcases/t_mbsrtowcs.c | 4 ++--
 mingw-w64-crt/testcases/t_wcrtomb.c   | 4 ++--
 mingw-w64-crt/testcases/t_wcsrtombs.c | 4 ++--
 mingw-w64-crt/testcases/t_wctob.c     | 4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/mingw-w64-crt/testcases/t_btowc.c 
b/mingw-w64-crt/testcases/t_btowc.c
index f81145bf0..714874ded 100644
--- a/mingw-w64-crt/testcases/t_btowc.c
+++ b/mingw-w64-crt/testcases/t_btowc.c
@@ -41,7 +41,7 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
+  assert (setlocale (LC_ALL, ".1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -69,7 +69,7 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, "Japanese_Japan.932") != NULL);
+  assert (setlocale (LC_ALL, ".932") != NULL);
   assert (MB_CUR_MAX == 2);
 
   /**
diff --git a/mingw-w64-crt/testcases/t_mbrlen.c 
b/mingw-w64-crt/testcases/t_mbrlen.c
index f43fd6c2e..fffe893f9 100644
--- a/mingw-w64-crt/testcases/t_mbrlen.c
+++ b/mingw-w64-crt/testcases/t_mbrlen.c
@@ -84,7 +84,7 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
+  assert (setlocale (LC_ALL, ".1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -111,7 +111,7 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, "Japanese_Japan.932") != NULL);
+  assert (setlocale (LC_ALL, ".932") != NULL);
   assert (MB_CUR_MAX == 2);
 
   /**
diff --git a/mingw-w64-crt/testcases/t_mbrtowc.c 
b/mingw-w64-crt/testcases/t_mbrtowc.c
index 03c36f600..32ecba129 100644
--- a/mingw-w64-crt/testcases/t_mbrtowc.c
+++ b/mingw-w64-crt/testcases/t_mbrtowc.c
@@ -88,7 +88,7 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
+  assert (setlocale (LC_ALL, ".1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -147,7 +147,7 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, "Japanese_Japan.932") != NULL);
+  assert (setlocale (LC_ALL, ".932") != NULL);
   assert (MB_CUR_MAX == 2);
 
   /**
diff --git a/mingw-w64-crt/testcases/t_mbsrtowcs.c 
b/mingw-w64-crt/testcases/t_mbsrtowcs.c
index b7b5a30a0..ab7020db9 100644
--- a/mingw-w64-crt/testcases/t_mbsrtowcs.c
+++ b/mingw-w64-crt/testcases/t_mbsrtowcs.c
@@ -150,7 +150,7 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
+  assert (setlocale (LC_ALL, ".1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /* Test SBCS input */
@@ -220,7 +220,7 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, "Japanese_Japan.932") != NULL);
+  assert (setlocale (LC_ALL, ".932") != NULL);
   assert (MB_CUR_MAX == 2);
 
   /* Test ASCII input */
diff --git a/mingw-w64-crt/testcases/t_wcrtomb.c 
b/mingw-w64-crt/testcases/t_wcrtomb.c
index b6a59f4c9..0e1ed9704 100644
--- a/mingw-w64-crt/testcases/t_wcrtomb.c
+++ b/mingw-w64-crt/testcases/t_wcrtomb.c
@@ -127,7 +127,7 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
+  assert (setlocale (LC_ALL, ".1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -215,7 +215,7 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, "Japanese_Japan.932") != NULL);
+  assert (setlocale (LC_ALL, ".932") != NULL);
   assert (MB_CUR_MAX == 2);
 
   /**
diff --git a/mingw-w64-crt/testcases/t_wcsrtombs.c 
b/mingw-w64-crt/testcases/t_wcsrtombs.c
index 6f8827d19..e3a4bd3ae 100644
--- a/mingw-w64-crt/testcases/t_wcsrtombs.c
+++ b/mingw-w64-crt/testcases/t_wcsrtombs.c
@@ -207,7 +207,7 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
+  assert (setlocale (LC_ALL, ".1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /* Test ASCII input */
@@ -378,7 +378,7 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, "Japanese_Japan.932") != NULL);
+  assert (setlocale (LC_ALL, ".932") != NULL);
   assert (MB_CUR_MAX == 2);
 
   /* Test ASCII input */
diff --git a/mingw-w64-crt/testcases/t_wctob.c 
b/mingw-w64-crt/testcases/t_wctob.c
index 15bc27d94..05210f5c8 100644
--- a/mingw-w64-crt/testcases/t_wctob.c
+++ b/mingw-w64-crt/testcases/t_wctob.c
@@ -43,7 +43,7 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, "English_United States.1252") != NULL);
+  assert (setlocale (LC_ALL, ".1252") != NULL);
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -97,7 +97,7 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, "Japanese_Japan.932") != NULL);
+  assert (setlocale (LC_ALL, ".932") != NULL);
   assert (MB_CUR_MAX == 2);
 
   /**
-- 
2.51.0.windows.1

From a6a29ce2528a71da37355feb08ac7196b8a36d8c Mon Sep 17 00:00:00 2001
From: Kirill Makurin <[email protected]>
Date: Wed, 8 Jul 2026 21:49:46 +0900
Subject: [PATCH 3/3] crt: tests: improve tests for C95 conversion functions

If a call to `setlocale` fails, simply skip related subtests.
Previously, failed call to `setlocale` would trigger an assertion.

This makes these tests more reliable on older Windows versions,
e.g. crtdll.dll on Windows 95 does not support locales other than "C".

Signed-off-by: Kirill Makurin <[email protected]>
---
 mingw-w64-crt/testcases/t_btowc.c     | 15 +++++++++++++--
 mingw-w64-crt/testcases/t_mbrlen.c    | 15 +++++++++++++--
 mingw-w64-crt/testcases/t_mbrtowc.c   | 15 +++++++++++++--
 mingw-w64-crt/testcases/t_mbsrtowcs.c | 15 +++++++++++++--
 mingw-w64-crt/testcases/t_wcrtomb.c   | 15 +++++++++++++--
 mingw-w64-crt/testcases/t_wcsrtombs.c | 15 +++++++++++++--
 mingw-w64-crt/testcases/t_wctob.c     | 15 +++++++++++++--
 7 files changed, 91 insertions(+), 14 deletions(-)

diff --git a/mingw-w64-crt/testcases/t_btowc.c 
b/mingw-w64-crt/testcases/t_btowc.c
index 714874ded..76576039a 100644
--- a/mingw-w64-crt/testcases/t_btowc.c
+++ b/mingw-w64-crt/testcases/t_btowc.c
@@ -41,7 +41,11 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, ".1252") != NULL);
+  if (setlocale (LC_ALL, ".1252") == NULL) {
+    wprintf (L"Skipping tests for SBCS code page 1252\n");
+    goto skip_sbcs;
+  }
+
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -58,6 +62,7 @@ int main (void) {
     assert (btowc (c) != WEOF);
   }
 
+skip_sbcs:
   /**
    * Disable tests for DBCS code pages with msvcrt10.dll since it does not
    * support multibyte characters.
@@ -69,7 +74,11 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, ".932") != NULL);
+  if (setlocale (LC_ALL, ".932") == NULL) {
+    wprintf (L"Skipping tests for DBCS code page 932\n");
+    goto skip_dbcs;
+  }
+
   assert (MB_CUR_MAX == 2);
 
   /**
@@ -87,6 +96,8 @@ int main (void) {
       assert (btowc (c) == WEOF);
     }
   }
+
+skip_dbcs:
 #endif
 #ifdef _UCRT
   /**
diff --git a/mingw-w64-crt/testcases/t_mbrlen.c 
b/mingw-w64-crt/testcases/t_mbrlen.c
index fffe893f9..c3c121331 100644
--- a/mingw-w64-crt/testcases/t_mbrlen.c
+++ b/mingw-w64-crt/testcases/t_mbrlen.c
@@ -84,7 +84,11 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, ".1252") != NULL);
+  if (setlocale (LC_ALL, ".1252") == NULL) {
+    wprintf (L"Skipping tests for SBCS code page 1252\n");
+    goto skip_sbcs;
+  }
+
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -100,6 +104,7 @@ int main (void) {
     }
   }
 
+skip_sbcs:
   /**
    * Disable tests for DBCS code pages with msvcrt10.dll since it does not
    * support multibyte characters.
@@ -111,7 +116,11 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, ".932") != NULL);
+  if (setlocale (LC_ALL, ".932") == NULL) {
+    wprintf (L"Skipping tests for DBCS code page 932\n");
+    goto skip_dbcs;
+  }
+
   assert (MB_CUR_MAX == 2);
 
   /**
@@ -158,6 +167,8 @@ int main (void) {
   assert (mbrlen ((char *) InvalidMultibyte, MB_CUR_MAX, &state) == (size_t) 
-1);
   assert (mbsinit (&state));
   assert (errno == EILSEQ);
+
+skip_dbcs:
 #endif
   return 0;
 }
diff --git a/mingw-w64-crt/testcases/t_mbrtowc.c 
b/mingw-w64-crt/testcases/t_mbrtowc.c
index 32ecba129..cf55fc78c 100644
--- a/mingw-w64-crt/testcases/t_mbrtowc.c
+++ b/mingw-w64-crt/testcases/t_mbrtowc.c
@@ -88,7 +88,11 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, ".1252") != NULL);
+  if (setlocale (LC_ALL, ".1252") == NULL) {
+    wprintf (L"Skipping tests for SBCS code page 1252\n");
+    goto skip_sbcs;
+  }
+
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -136,6 +140,7 @@ int main (void) {
     }
   }
 
+skip_sbcs:
   /**
    * Disable tests for DBCS code pages with msvcrt10.dll since it does not
    * support multibyte characters.
@@ -147,7 +152,11 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, ".932") != NULL);
+  if (setlocale (LC_ALL, ".932") == NULL) {
+    wprintf (L"Skipping tests for DBCS code page 932\n");
+    goto skip_dbcs;
+  }
+
   assert (MB_CUR_MAX == 2);
 
   /**
@@ -207,6 +216,8 @@ int main (void) {
   assert (wc == WEOF);
   assert (mbsinit (&state));
   assert (errno == EILSEQ);
+
+skip_dbcs:
 #endif
   return 0;
 }
diff --git a/mingw-w64-crt/testcases/t_mbsrtowcs.c 
b/mingw-w64-crt/testcases/t_mbsrtowcs.c
index ab7020db9..a9dda5dda 100644
--- a/mingw-w64-crt/testcases/t_mbsrtowcs.c
+++ b/mingw-w64-crt/testcases/t_mbsrtowcs.c
@@ -150,7 +150,11 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, ".1252") != NULL);
+  if (setlocale (LC_ALL, ".1252") == NULL) {
+    wprintf (L"Skipping tests for SBCS code page 1252\n");
+    goto skip_sbcs;
+  }
+
   assert (MB_CUR_MAX == 1);
 
   /* Test SBCS input */
@@ -209,6 +213,7 @@ int main (void) {
   assert (errno == 0);
   assert (buffer[8] == WEOF);
 
+skip_sbcs:
   /**
    * Disable tests for DBCS code pages with msvcrt10.dll since it does not
    * support multibyte characters.
@@ -220,7 +225,11 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, ".932") != NULL);
+  if (setlocale (LC_ALL, ".932") == NULL) {
+    wprintf (L"Skipping tests for DBCS code page 932\n");
+    goto skip_dbcs;
+  }
+
   assert (MB_CUR_MAX == 2);
 
   /* Test ASCII input */
@@ -396,6 +405,8 @@ int main (void) {
   assert (errno == EILSEQ);
   /* This assertion fails with CRT's version */
   assert (buffer[0] != WEOF && buffer[1] != WEOF && buffer[2] == WEOF);
+
+skip_dbcs:
 #endif
   return 0;
 }
diff --git a/mingw-w64-crt/testcases/t_wcrtomb.c 
b/mingw-w64-crt/testcases/t_wcrtomb.c
index 0e1ed9704..f7186c570 100644
--- a/mingw-w64-crt/testcases/t_wcrtomb.c
+++ b/mingw-w64-crt/testcases/t_wcrtomb.c
@@ -127,7 +127,11 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, ".1252") != NULL);
+  if (setlocale (LC_ALL, ".1252") == NULL) {
+    wprintf (L"Skipping tests for SBCS code page 1252\n");
+    goto skip_sbcs;
+  }
+
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -204,6 +208,7 @@ int main (void) {
     }
   }
 
+skip_sbcs:
   /**
    * Disable tests for DBCS code pages with msvcrt10.dll since it does not
    * support multibyte characters.
@@ -215,7 +220,11 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, ".932") != NULL);
+  if (setlocale (LC_ALL, ".932") == NULL) {
+    wprintf (L"Skipping tests for DBCS code page 932\n");
+    goto skip_dbcs;
+  }
+
   assert (MB_CUR_MAX == 2);
 
   /**
@@ -265,6 +274,8 @@ int main (void) {
       break;
     }
   }
+
+skip_dbcs:
 #endif
   return 0;
 }
diff --git a/mingw-w64-crt/testcases/t_wcsrtombs.c 
b/mingw-w64-crt/testcases/t_wcsrtombs.c
index e3a4bd3ae..b130517c7 100644
--- a/mingw-w64-crt/testcases/t_wcsrtombs.c
+++ b/mingw-w64-crt/testcases/t_wcsrtombs.c
@@ -207,7 +207,11 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, ".1252") != NULL);
+  if (setlocale (LC_ALL, ".1252") == NULL) {
+    wprintf (L"Skipping tests for SBCS code page 1252\n");
+    goto skip_sbcs;
+  }
+
   assert (MB_CUR_MAX == 1);
 
   /* Test ASCII input */
@@ -367,6 +371,7 @@ int main (void) {
   // reset errno
   _set_errno (0);
 
+skip_sbcs:
   /**
    * Disable tests for DBCS code pages with msvcrt10.dll since it does not
    * support multibyte characters.
@@ -378,7 +383,11 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, ".932") != NULL);
+  if (setlocale (LC_ALL, ".932") == NULL) {
+    wprintf (L"Skipping tests for DBCS code page 932\n");
+    goto skip_dbcs;
+  }
+
   assert (MB_CUR_MAX == 2);
 
   /* Test ASCII input */
@@ -589,6 +598,8 @@ int main (void) {
 
   // reset errno
   _set_errno (0);
+
+skip_dbcs:
 #endif
   return 0;
 }
diff --git a/mingw-w64-crt/testcases/t_wctob.c 
b/mingw-w64-crt/testcases/t_wctob.c
index 05210f5c8..31faa92e1 100644
--- a/mingw-w64-crt/testcases/t_wctob.c
+++ b/mingw-w64-crt/testcases/t_wctob.c
@@ -43,7 +43,11 @@ int main (void) {
   /**
    * Test SBCS code page
    */
-  assert (setlocale (LC_ALL, ".1252") != NULL);
+  if (setlocale (LC_ALL, ".1252") == NULL) {
+    wprintf (L"Skipping tests for SBCS code page 1252\n");
+    goto skip_sbcs;
+  }
+
   assert (MB_CUR_MAX == 1);
 
   /**
@@ -86,6 +90,7 @@ int main (void) {
     }
   }
 
+skip_sbcs:
   /**
    * Disable tests for DBCS code pages with msvcrt10.dll since it does not
    * support multibyte characters.
@@ -97,7 +102,11 @@ int main (void) {
   /**
    * Test DBCS code page
    */
-  assert (setlocale (LC_ALL, ".932") != NULL);
+  if (setlocale (LC_ALL, ".932") == NULL) {
+    wprintf (L"Skipping tests for DBCS code page 932\n");
+    goto skip_dbcs;
+  }
+
   assert (MB_CUR_MAX == 2);
 
   /**
@@ -128,6 +137,8 @@ int main (void) {
       break;
     }
   }
+
+skip_dbcs:
 #endif
 #ifdef _UCRT
   /**
-- 
2.51.0.windows.1

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to