diff options
author | Rhodri James <rhodri@kynesim.co.uk> | 2017-02-08 13:54:59 +0000 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2017-03-13 15:39:38 +0100 |
commit | a0eca419bdf068df4896b01c3a907fea846fe65d (patch) | |
tree | 301bb34bff74abc3552a70f11e84a77ae077d09d /expat | |
parent | 2dbc5c800b12d92408c269c934736104c1866745 (diff) | |
download | libexpat-git-a0eca419bdf068df4896b01c3a907fea846fe65d.tar.gz |
Extend coverage of byte information function tests
Diffstat (limited to 'expat')
-rw-r--r-- | expat/tests/runtests.c | 16 |
1 files changed, 16 insertions, 0 deletions
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 = "<doc></wombat></doc>"; + + 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, |