]> granicus.if.org Git - libexpat/commitdiff
runtests.c: Fix for -DEXPAT_NS=OFF
authorSebastian Pipping <sebastian@pipping.org>
Sun, 29 Sep 2019 18:17:38 +0000 (20:17 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sun, 29 Sep 2019 18:36:28 +0000 (20:36 +0200)
expat/tests/runtests.c

index 88a45de4b8c2b1a1aab2c0c77c7bc6d27116757e..2c951f50e99c63b2ed4e464b450c4d9851e961ab 100644 (file)
@@ -7053,17 +7053,39 @@ END_TEST
 /* Test that too many colons are rejected */
 START_TEST(test_ns_double_colon) {
   const char *text = "<foo:e xmlns:foo='http://example.org/' foo:a:b='bar' />";
-
-  expect_failure(text, XML_ERROR_INVALID_TOKEN,
-                 "Double colon in attribute name not faulted");
+  const enum XML_Status status
+      = _XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE);
+#ifdef XML_NS
+  if ((status == XML_STATUS_OK)
+      || (XML_GetErrorCode(g_parser) != XML_ERROR_INVALID_TOKEN)) {
+    fail("Double colon in attribute name not faulted"
+         " (despite active namespace support)");
+  }
+#else
+  if (status != XML_STATUS_OK) {
+    fail("Double colon in attribute name faulted"
+         " (despite inactive namespace support");
+  }
+#endif
 }
 END_TEST
 
 START_TEST(test_ns_double_colon_element) {
   const char *text = "<foo:bar:e xmlns:foo='http://example.org/' />";
-
-  expect_failure(text, XML_ERROR_INVALID_TOKEN,
-                 "Double colon in element name not faulted");
+  const enum XML_Status status
+      = _XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE);
+#ifdef XML_NS
+  if ((status == XML_STATUS_OK)
+      || (XML_GetErrorCode(g_parser) != XML_ERROR_INVALID_TOKEN)) {
+    fail("Double colon in element name not faulted"
+         " (despite active namespace support)");
+  }
+#else
+  if (status != XML_STATUS_OK) {
+    fail("Double colon in element name faulted"
+         " (despite inactive namespace support");
+  }
+#endif
 }
 END_TEST