diff options
author | Rhodri James <rhodri@kynesim.co.uk> | 2017-02-08 13:06:32 +0000 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2017-03-13 15:22:52 +0100 |
commit | 012de3c01b789ba68320a7092a444469c7613c68 (patch) | |
tree | cc8119c9ec07945d4043239a5d90fd61360c8021 /expat | |
parent | cf29d40fd33468f35b07534218e2a48ef404d452 (diff) | |
download | libexpat-git-012de3c01b789ba68320a7092a444469c7613c68.tar.gz |
Improve test coverage of XML_ResumeParser
Diffstat (limited to 'expat')
-rw-r--r-- | expat/tests/runtests.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 9d9d2126..a9268d37 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -1762,6 +1762,27 @@ START_TEST(test_resume_invalid_parse) } END_TEST +/* Test that re-suspended parses are correctly passed through */ +START_TEST(test_resume_resuspended) +{ + const char *text = "<doc>Hello<meep/>world</doc>"; + + resumable = XML_TRUE; + XML_SetCharacterDataHandler(parser, + clearing_aborting_character_handler); + if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + resumable = XML_TRUE; + XML_SetCharacterDataHandler(parser, + clearing_aborting_character_handler); + if (XML_ResumeParser(parser) != XML_STATUS_SUSPENDED) + fail("Resumption not suspended"); + /* This one should succeed and finish up */ + if (XML_ResumeParser(parser) != XML_STATUS_OK) + xml_failure(parser); +} +END_TEST + /* Test resetting a subordinate parser does exactly nothing */ static int XMLCALL external_entity_resetter(XML_Parser parser, @@ -3252,6 +3273,7 @@ make_suite(void) tcase_add_test(tc_basic, test_attributes); tcase_add_test(tc_basic, test_reset_in_entity); tcase_add_test(tc_basic, test_resume_invalid_parse); + tcase_add_test(tc_basic, test_resume_resuspended); tcase_add_test(tc_basic, test_subordinate_reset); tcase_add_test(tc_basic, test_subordinate_suspend); tcase_add_test(tc_basic, test_explicit_encoding); |