fix unicode tests not working on all platforms

Mon, 10 Feb 2025 19:20:43 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 10 Feb 2025 19:20:43 +0100
changeset 1177
04ede4de9cec
parent 1176
247db6e629ad
child 1178
9998cfb4a65b

fix unicode tests not working on all platforms

tests/test_json.c file | annotate | diff | comparison | revisions
--- a/tests/test_json.c	Mon Feb 10 18:25:16 2025 +0100
+++ b/tests/test_json.c	Mon Feb 10 19:20:43 2025 +0100
@@ -197,7 +197,7 @@
         CX_TEST_ASSERT(cxJsonIsString(wide));
         CX_TEST_ASSERT(0 == cx_strcmp(
             cxJsonAsCxString(wide),
-            CX_STR("\u03a3\u29b0"))
+            CX_STR(u8"\u03a3\u29b0"))
         );
         
         CxJsonValue *surrogatepair1 = cxJsonObjGet(obj, "surrogatepair1");
@@ -215,10 +215,12 @@
         );
         
         CxJsonValue *mixed2 = cxJsonObjGet(obj, "mixed2");
-        CX_TEST_ASSERT(cxJsonIsString(mixed2));
+        char test[16];
+        strncpy(test, mixed2->value.string.ptr, 15);
+       CX_TEST_ASSERT(cxJsonIsString(mixed2));
         CX_TEST_ASSERT(0 == cx_strcmp(
             cxJsonAsCxString(mixed2),
-            CX_STR("123\u03a3\xf0\x9f\xaf\x85ß"))
+            CX_STR("123\xce\xa3\xf0\x9f\xaf\x85ß"))
         );
         
         cxJsonValueFree(obj);

mercurial