mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-08 06:29:23 +00:00
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.
This commit is contained in:
parent
6143619cf2
commit
80cac4a780
1 changed files with 34 additions and 2 deletions
|
@ -511,7 +511,7 @@ END_TEST
|
|||
/* 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 @@ START_TEST(test_wfc_declared_entity_unread_external_subset) {
|
|||
}
|
||||
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 @@ make_basic_suite(void)
|
|||
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,
|
||||
|
|
Loading…
Add table
Reference in a new issue