From 12fb5000c2baf96fbb20b76f982e2a234711933c Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Tue, 21 Feb 2017 12:43:22 +0000 Subject: [PATCH] Check skipped entity handler --- expat/tests/runtests.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 5b4e3786..2872f661 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -1756,6 +1756,18 @@ END_TEST static void *handler_data = NULL; /* Count of the number of times the comment handler has been invoked */ static int comment_count = 0; +/* Count of the number of skipped entities */ +static int skip_count = 0; + +static void XMLCALL +param_check_skip_handler(void *userData, + const XML_Char *UNUSED_P(entityName), + int UNUSED_P(is_parameter_entity)) +{ + if (userData != handler_data) + fail("User data (skip) not correctly set"); + skip_count++; +} static void XMLCALL data_check_comment_handler(void *userData, const XML_Char *UNUSED_P(data)) @@ -1806,9 +1818,11 @@ START_TEST(test_user_parameters) ""; comment_count = 0; + skip_count = 0; XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); XML_SetExternalEntityRefHandler(parser, external_entity_param_checker); XML_SetCommentHandler(parser, data_check_comment_handler); + XML_SetSkippedEntityHandler(parser, param_check_skip_handler); XML_UseParserAsHandlerArg(parser); XML_SetUserData(parser, (void *)1); handler_data = parser; @@ -1822,6 +1836,8 @@ START_TEST(test_user_parameters) xml_failure(parser); if (comment_count != 3) fail("Comment handler not invoked enough times"); + if (skip_count != 1) + fail("Skip handler not invoked enough times"); } END_TEST