From a0eca419bdf068df4896b01c3a907fea846fe65d Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Wed, 8 Feb 2017 13:54:59 +0000 Subject: [PATCH] Extend coverage of byte information function tests --- expat/tests/runtests.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 15bd505c..fa07d5a7 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -2224,6 +2224,21 @@ START_TEST(test_byte_info_at_end) } END_TEST +/* Test position information from errors */ +START_TEST(test_byte_info_at_error) +{ + const char *text = ""; + + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_OK) + fail("Syntax error not faulted"); + if (XML_GetCurrentByteCount(parser) != 0) + fail("Error byte count incorrect"); + if (XML_GetCurrentByteIndex(parser) != 7) + fail("Error byte index incorrect"); +} +END_TEST + /* * Namespaces tests. @@ -3302,6 +3317,7 @@ make_suite(void) tcase_add_test(tc_basic, test_get_buffer_1); tcase_add_test(tc_basic, test_get_buffer_2); tcase_add_test(tc_basic, test_byte_info_at_end); + tcase_add_test(tc_basic, test_byte_info_at_error); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace,