[Expat-CVS] expat/tests runtests.c,1.29,1.30
Fred L. Drake
fdrake@users.sourceforge.net
Thu Aug 22 20:15:02 2002
Update of /cvsroot/expat/expat/tests
In directory usw-pr-cvs1:/tmp/cvs-serv4215
Modified Files:
runtests.c
Log Message:
Renamed the last test added to be more clear about the condition being
tested.
Added a couple of additional tests checking for proper response to the
same well-formedness constraint. No bugs to fix there, just trying to
improve the coverage of the test suite.
Index: runtests.c
===================================================================
RCS file: /cvsroot/expat/expat/tests/runtests.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- runtests.c 22 Aug 2002 21:41:05 -0000 1.29
+++ runtests.c 23 Aug 2002 03:14:01 -0000 1.30
@@ -511,7 +511,7 @@
/* Test that no error is reported for unknown entities if we don't
read an external subset. This was fixed in Expat 1.95.5.
*/
-START_TEST(test_wfc_declared_entity_unread_external_subset) {
+START_TEST(test_wfc_undeclared_entity_unread_external_subset) {
char *text =
"<!DOCTYPE doc SYSTEM 'foo'>\n"
"<doc>&entity;</doc>";
@@ -521,6 +521,35 @@
}
END_TEST
+/* Test that an error is reported for unknown entities if we don't
+ have an external subset.
+*/
+START_TEST(test_wfc_undeclared_entity_no_external_subset) {
+ char *text = "<doc>&entity;</doc>";
+
+ if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_OK)
+ fail("Parser did not report error on undefined entity w/out a DTD.");
+ if (XML_GetErrorCode(parser) != XML_ERROR_UNDEFINED_ENTITY)
+ xml_failure(parser);
+}
+END_TEST
+
+/* Test that an error is reported for unknown entities if we don't
+ read an external subset, but have been declared standalone.
+*/
+START_TEST(test_wfc_undeclared_entity_standalone) {
+ char *text =
+ "<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\n"
+ "<!DOCTYPE doc SYSTEM 'foo'>\n"
+ "<doc>&entity;</doc>";
+
+ if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_OK)
+ fail("Parser did not report error on undefined entity (standalone).");
+ if (XML_GetErrorCode(parser) != XML_ERROR_UNDEFINED_ENTITY)
+ xml_failure(parser);
+}
+END_TEST
+
/*
* Namespaces tests.
@@ -703,7 +732,10 @@
tcase_add_test(tc_basic, test_attr_whitespace_normalization);
tcase_add_test(tc_basic, test_xmldecl_misplaced);
tcase_add_test(tc_basic, test_unknown_encoding_internal_entity);
- tcase_add_test(tc_basic, test_wfc_declared_entity_unread_external_subset);
+ tcase_add_test(tc_basic,
+ test_wfc_undeclared_entity_unread_external_subset);
+ tcase_add_test(tc_basic, test_wfc_undeclared_entity_no_external_subset);
+ tcase_add_test(tc_basic, test_wfc_undeclared_entity_standalone);
suite_add_tcase(s, tc_namespace);
tcase_add_checked_fixture(tc_namespace,