diff --git a/expat/tests/basic_tests.c b/expat/tests/basic_tests.c
index da2a6ca4..bbfd4441 100644
--- a/expat/tests/basic_tests.c
+++ b/expat/tests/basic_tests.c
@@ -3298,6 +3298,48 @@ START_TEST(test_suspend_epilog) {
}
END_TEST
+START_TEST(test_suspend_in_sole_empty_tag) {
+ const char *text = "";
+ enum XML_Status rc;
+
+ XML_SetEndElementHandler(g_parser, suspending_end_handler);
+ XML_SetUserData(g_parser, g_parser);
+ rc = _XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE);
+ if (rc == XML_STATUS_ERROR)
+ xml_failure(g_parser);
+ else if (rc != XML_STATUS_SUSPENDED)
+ fail("Suspend not triggered");
+ rc = XML_ResumeParser(g_parser);
+ if (rc == XML_STATUS_ERROR)
+ xml_failure(g_parser);
+ else if (rc != XML_STATUS_OK)
+ fail("Resume failed");
+}
+END_TEST
+
+START_TEST(test_unfinished_epilog) {
+ const char *text = "<";
+
+ expect_failure(text, XML_ERROR_UNCLOSED_TOKEN,
+ "Incomplete epilog entry not faulted");
+}
+END_TEST
+
+START_TEST(test_partial_char_in_epilog) {
+ const char *text = "\xe2\x82";
+
+ /* First check that no fault is raised if the parse is not finished */
+ if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE)
+ == XML_STATUS_ERROR)
+ xml_failure(g_parser);
+ /* Now check that it is faulted once we finish */
+ if (XML_ParseBuffer(g_parser, 0, XML_TRUE) != XML_STATUS_ERROR)
+ fail("Partial character in epilog not faulted");
+ if (XML_GetErrorCode(g_parser) != XML_ERROR_PARTIAL_CHAR)
+ xml_failure(g_parser);
+}
+END_TEST
+
TCase *
make_basic_test_case(Suite *s) {
TCase *tc_basic = tcase_create("basic tests");
@@ -3447,6 +3489,9 @@ make_basic_test_case(Suite *s) {
tcase_add_test(tc_basic, test_abort_epilog);
tcase_add_test(tc_basic, test_abort_epilog_2);
tcase_add_test(tc_basic, test_suspend_epilog);
+ tcase_add_test(tc_basic, test_suspend_in_sole_empty_tag);
+ tcase_add_test(tc_basic, test_unfinished_epilog);
+ tcase_add_test(tc_basic, test_partial_char_in_epilog);
return tc_basic; /* TEMPORARY: this will become a void function */
}
diff --git a/expat/tests/handlers.c b/expat/tests/handlers.c
index 8e669d91..0537e33d 100644
--- a/expat/tests/handlers.c
+++ b/expat/tests/handlers.c
@@ -152,6 +152,12 @@ counting_start_element_handler(void *userData, const XML_Char *name,
}
}
+void XMLCALL
+suspending_end_handler(void *userData, const XML_Char *s) {
+ UNUSED_P(s);
+ XML_StopParser((XML_Parser)userData, 1);
+}
+
/* Text encoding handlers */
int XMLCALL
diff --git a/expat/tests/handlers.h b/expat/tests/handlers.h
index c54ad0fa..e70aba31 100644
--- a/expat/tests/handlers.h
+++ b/expat/tests/handlers.h
@@ -93,6 +93,8 @@ extern void XMLCALL counting_start_element_handler(void *userData,
const XML_Char *name,
const XML_Char **atts);
+extern void XMLCALL suspending_end_handler(void *userData, const XML_Char *s);
+
/* Text encoding handlers */
extern int XMLCALL UnknownEncodingHandler(void *data, const XML_Char *encoding,
diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c
index e6eaef87..23393d43 100644
--- a/expat/tests/runtests.c
+++ b/expat/tests/runtests.c
@@ -74,54 +74,6 @@
XML_Parser g_parser = NULL;
-static void XMLCALL
-suspending_end_handler(void *userData, const XML_Char *s) {
- UNUSED_P(s);
- XML_StopParser((XML_Parser)userData, 1);
-}
-
-START_TEST(test_suspend_in_sole_empty_tag) {
- const char *text = "";
- enum XML_Status rc;
-
- XML_SetEndElementHandler(g_parser, suspending_end_handler);
- XML_SetUserData(g_parser, g_parser);
- rc = _XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE);
- if (rc == XML_STATUS_ERROR)
- xml_failure(g_parser);
- else if (rc != XML_STATUS_SUSPENDED)
- fail("Suspend not triggered");
- rc = XML_ResumeParser(g_parser);
- if (rc == XML_STATUS_ERROR)
- xml_failure(g_parser);
- else if (rc != XML_STATUS_OK)
- fail("Resume failed");
-}
-END_TEST
-
-START_TEST(test_unfinished_epilog) {
- const char *text = "<";
-
- expect_failure(text, XML_ERROR_UNCLOSED_TOKEN,
- "Incomplete epilog entry not faulted");
-}
-END_TEST
-
-START_TEST(test_partial_char_in_epilog) {
- const char *text = "\xe2\x82";
-
- /* First check that no fault is raised if the parse is not finished */
- if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE)
- == XML_STATUS_ERROR)
- xml_failure(g_parser);
- /* Now check that it is faulted once we finish */
- if (XML_ParseBuffer(g_parser, 0, XML_TRUE) != XML_STATUS_ERROR)
- fail("Partial character in epilog not faulted");
- if (XML_GetErrorCode(g_parser) != XML_ERROR_PARTIAL_CHAR)
- xml_failure(g_parser);
-}
-END_TEST
-
/* Test resuming a parse suspended in entity substitution */
static void XMLCALL
start_element_suspender(void *userData, const XML_Char *name,
@@ -7264,9 +7216,6 @@ make_suite(void) {
TCase *tc_accounting = tcase_create("accounting tests");
#endif
- tcase_add_test(tc_basic, test_suspend_in_sole_empty_tag);
- tcase_add_test(tc_basic, test_unfinished_epilog);
- tcase_add_test(tc_basic, test_partial_char_in_epilog);
tcase_add_test__ifdef_xml_dtd(tc_basic, test_suspend_resume_internal_entity);
tcase_add_test__ifdef_xml_dtd(tc_basic,
test_suspend_resume_internal_entity_issue_629);