]> granicus.if.org Git - libexpat/commitdiff
Fix test_dtd_attr_handling() to work with UTF-16 builds
authorRhodri James <rhodri@kynesim.co.uk>
Tue, 22 Aug 2017 12:47:33 +0000 (13:47 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Tue, 29 Aug 2017 21:13:13 +0000 (23:13 +0200)
expat/tests/runtests.c

index 8ceb4032b3d0bae5a758cb4a9d16bb66814db8dd..618decea65997ec99d92c8846d317124b9b574c3 100644 (file)
@@ -1976,7 +1976,7 @@ END_TEST
 
 /* Test handling of attribute declarations */
 typedef struct AttTest {
-    const XML_Char *definition;
+    const char *definition;
     const XML_Char *element_name;
     const XML_Char *attr_name;
     const XML_Char *attr_type;
@@ -1994,15 +1994,15 @@ verify_attlist_decl_handler(void *userData,
 {
     AttTest *at = (AttTest *)userData;
 
-    if (strcmp(element_name, at->element_name))
+    if (xcstrcmp(element_name, at->element_name))
         fail("Unexpected element name in attribute declaration");
-    if (strcmp(attr_name, at->attr_name))
+    if (xcstrcmp(attr_name, at->attr_name))
         fail("Unexpected attribute name in attribute declaration");
-    if (strcmp(attr_type, at->attr_type))
+    if (xcstrcmp(attr_type, at->attr_type))
         fail("Unexpected attribute type in attribute declaration");
     if ((default_value == NULL && at->default_value != NULL) ||
         (default_value != NULL && at->default_value == NULL) ||
-        (default_value != NULL && strcmp(default_value, at->default_value)))
+        (default_value != NULL && xcstrcmp(default_value, at->default_value)))
         fail("Unexpected default value in attribute declaration");
     if (is_required != at->is_required)
         fail("Requirement mismatch in attribute declaration");
@@ -2018,9 +2018,9 @@ START_TEST(test_dtd_attr_handling)
             "<!ATTLIST doc a ( one | two | three ) #REQUIRED>\n"
             "]>"
             "<doc a='two'/>",
-            "doc",
-            "a",
-            "(one|two|three)", /* Extraneous spaces will be removed */
+            XCS("doc"),
+            XCS("a"),
+            XCS("(one|two|three)"), /* Extraneous spaces will be removed */
             NULL,
             XML_TRUE
         },
@@ -2029,9 +2029,9 @@ START_TEST(test_dtd_attr_handling)
             "<!ATTLIST doc a NOTATION (foo) #IMPLIED>\n"
             "]>"
             "<doc/>",
-            "doc",
-            "a",
-            "NOTATION(foo)",
+            XCS("doc"),
+            XCS("a"),
+            XCS("NOTATION(foo)"),
             NULL,
             XML_FALSE
         },
@@ -2039,20 +2039,24 @@ START_TEST(test_dtd_attr_handling)
             "<!ATTLIST doc a NOTATION (foo) 'bar'>\n"
             "]>"
             "<doc/>",
-            "doc",
-            "a",
-            "NOTATION(foo)",
-            "bar",
+            XCS("doc"),
+            XCS("a"),
+            XCS("NOTATION(foo)"),
+            XCS("bar"),
             XML_FALSE
         },
         {
             "<!ATTLIST doc a CDATA '\xdb\xb2'>\n"
             "]>"
             "<doc/>",
-            "doc",
-            "a",
-            "CDATA",
-            "\xdb\xb2",
+            XCS("doc"),
+            XCS("a"),
+            XCS("CDATA"),
+#ifdef XML_UNICODE
+            XCS("\x06f2"),
+#else
+            XCS("\xdb\xb2"),
+#endif
             XML_FALSE
         },
         { NULL, NULL, NULL, NULL, NULL, XML_FALSE }