Test XML_ErrorString range checking

This commit is contained in:
Rhodri James 2017-02-08 14:40:37 +00:00 committed by Sebastian Pipping
parent 822036fd12
commit 69b23486c9

View file

@ -2845,6 +2845,16 @@ START_TEST(test_misc_null_parser)
}
END_TEST
/* Test that XML_ErrorString rejects out-of-range codes */
START_TEST(test_misc_error_string)
{
if (XML_ErrorString((enum XML_Error)-1) != NULL)
fail("Negative error code not rejected");
if (XML_ErrorString((enum XML_Error)100) != NULL)
fail("Large error code not rejected");
}
END_TEST
static void
alloc_setup(void)
@ -3382,6 +3392,7 @@ make_suite(void)
tcase_add_test(tc_misc, test_misc_alloc_ns);
tcase_add_test(tc_misc, test_misc_null_parser);
tcase_add_test(tc_misc, test_misc_alloc_ns_parse_buffer);
tcase_add_test(tc_misc, test_misc_error_string);
suite_add_tcase(s, tc_alloc);
tcase_add_checked_fixture(tc_alloc, alloc_setup, alloc_teardown);