From ecfd3f15ad42654b9d37523a83be39e1e4eb4ba1 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Thu, 16 Mar 2017 17:12:52 +0000 Subject: [PATCH] Test handling of partial characters at the end of the epilog --- expat/tests/runtests.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 65b084e7..e9622cf8 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -4575,6 +4575,22 @@ START_TEST(test_unfinished_epilog) } 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(parser, text, strlen(text), + XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + /* Now check that it is faulted once we finish */ + if (XML_ParseBuffer(parser, 0, XML_TRUE) != XML_STATUS_ERROR) + fail("Partial character in epilog not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_PARTIAL_CHAR) + xml_failure(parser); +} +END_TEST + /* * Namespaces tests. @@ -7840,6 +7856,7 @@ make_suite(void) tcase_add_test(tc_basic, test_suspend_xdecl); tcase_add_test(tc_basic, test_abort_epilog); tcase_add_test(tc_basic, test_unfinished_epilog); + tcase_add_test(tc_basic, test_partial_char_in_epilog); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace,