Extend coverage of byte information function tests

This commit is contained in:
Rhodri James 2017-02-08 13:54:59 +00:00 committed by Sebastian Pipping
parent 2dbc5c800b
commit a0eca419bd

View file

@ -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,