]> granicus.if.org Git - libexpat/commitdiff
Fix test_latin1_umlauts() to work for UTF-16
authorRhodri James <rhodri@kynesim.co.uk>
Fri, 4 Aug 2017 17:32:50 +0000 (18:32 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Tue, 29 Aug 2017 20:30:33 +0000 (22:30 +0200)
expat/tests/runtests.c

index ad3fd9c1977767545f223c2e67be9e00d1d5fe39..bca3b1c3f9bb58a0b9c7133f8bb147b204a13646 100644 (file)
@@ -894,20 +894,30 @@ START_TEST(test_latin1_umlauts)
         "<?xml version='1.0' encoding='iso-8859-1'?>\n"
         "<e a='\xE4 \xF6 \xFC &#228; &#246; &#252; &#x00E4; &#x0F6; &#xFC; >'\n"
         "  >\xE4 \xF6 \xFC &#228; &#246; &#252; &#x00E4; &#x0F6; &#xFC; ></e>";
-    const char *utf8 =
-        "\xC3\xA4 \xC3\xB6 \xC3\xBC "
-        "\xC3\xA4 \xC3\xB6 \xC3\xBC "
-        "\xC3\xA4 \xC3\xB6 \xC3\xBC >";
-    run_character_check(text, utf8);
+#ifdef XML_UNICODE
+    /* Expected results in UTF-16 */
+    const XML_Char *expected =
+        XCS("\x00e4 \x00f6 \x00fc ")
+        XCS("\x00e4 \x00f6 \x00fc ")
+        XCS("\x00e4 \x00f6 \x00fc >");
+#else
+    /* Expected results in UTF-8 */
+    const XML_Char *expected =
+        XCS("\xC3\xA4 \xC3\xB6 \xC3\xBC ")
+        XCS("\xC3\xA4 \xC3\xB6 \xC3\xBC ")
+        XCS("\xC3\xA4 \xC3\xB6 \xC3\xBC >");
+#endif
+
+    run_character_check(text, expected);
     XML_ParserReset(parser, NULL);
-    run_attribute_check(text, utf8);
+    run_attribute_check(text, expected);
     /* Repeat with a default handler */
     XML_ParserReset(parser, NULL);
     XML_SetDefaultHandler(parser, dummy_default_handler);
-    run_character_check(text, utf8);
+    run_character_check(text, expected);
     XML_ParserReset(parser, NULL);
     XML_SetDefaultHandler(parser, dummy_default_handler);
-    run_attribute_check(text, utf8);
+    run_attribute_check(text, expected);
 }
 END_TEST