]> granicus.if.org Git - libexpat/commitdiff
Test redefining predefined entities
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 9 Mar 2017 19:00:42 +0000 (19:00 +0000)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 19:46:16 +0000 (21:46 +0200)
expat/tests/runtests.c

index 704bc6e59b8b38b519e6e3b2a480e6433915bbe8..47b849d6b9b018f9b1084c90e63c12596ab8afdb 100644 (file)
@@ -4143,6 +4143,22 @@ START_TEST(test_attribute_enum_value)
 }
 END_TEST
 
+/* Slightly bizarrely, the library seems to silently ignore entity
+ * definitions for predefined entities, even when they are wrong.  The
+ * language of the XML 1.0 spec is somewhat unhelpful as to what ought
+ * to happen, so this is currently treated as acceptable.
+ */
+START_TEST(test_predefined_entity_redefinition)
+{
+    const char *text =
+        "<!DOCTYPE doc [\n"
+        "<!ENTITY apos 'foo'>\n"
+        "]>\n"
+        "<doc>&apos;</doc>";
+    run_character_check(text, "'");
+}
+END_TEST
+
 /*
  * Namespaces tests.
  */
@@ -6990,6 +7006,7 @@ make_suite(void)
     tcase_add_test(tc_basic, test_ext_entity_value_abort);
     tcase_add_test(tc_basic, test_bad_public_doctype);
     tcase_add_test(tc_basic, test_attribute_enum_value);
+    tcase_add_test(tc_basic, test_predefined_entity_redefinition);
 
     suite_add_tcase(s, tc_namespace);
     tcase_add_checked_fixture(tc_namespace,