Alexandre Julliard : ntdll/tests: Fix string test for UTF-8 default codepage.

Alexandre Julliard julliard at winehq.org
Wed Mar 23 17:03:54 CDT 2022


Module: wine
Branch: master
Commit: 63d7591b3cf510f32353ea7aa9bed07afcb57fa0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=63d7591b3cf510f32353ea7aa9bed07afcb57fa0

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 23 18:31:31 2022 +0100

ntdll/tests: Fix string test for UTF-8 default codepage.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/string.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/tests/string.c b/dlls/ntdll/tests/string.c
index eabbe86792b..3d9ae94c79a 100644
--- a/dlls/ntdll/tests/string.c
+++ b/dlls/ntdll/tests/string.c
@@ -1837,7 +1837,7 @@ static void test_toupper(void)
 {
 
     int i, ret, exp_ret;
-    char str[2], *p;
+    char str[3], *p;
     WCHAR wc;
 
     ok(ptoupper != NULL, "toupper is not available\n");
@@ -1846,17 +1846,20 @@ static void test_toupper(void)
     {
         str[0] = i;
         str[1] = i >> 8;
+        str[2] = 0;
         p = str;
         wc = RtlAnsiCharToUnicodeChar( &p );
         wc = RtlUpcaseUnicodeChar( wc );
         ret = WideCharToMultiByte( CP_ACP, 0, &wc, 1, str, 2, NULL, NULL );
-        ok(ret == 1 || ret == 2, "WideCharToMultiByte returned %d\n", ret);
+        ok(!ret || ret == 1 || ret == 2, "WideCharToMultiByte returned %d\n", ret);
         if (ret == 2)
             exp_ret = (unsigned char)str[1] + ((unsigned char)str[0] << 8);
-        else
+        else if (ret == 1)
             exp_ret = (unsigned char)str[0];
+        else
+            exp_ret = (WCHAR)i;
 
-        ret = ptoupper(i);
+        ret = (WCHAR)ptoupper(i);
         ok(ret == exp_ret, "toupper(%x) = %x, expected %x\n", i, ret, exp_ret);
     }
 }




More information about the wine-cvs mailing list