From cb4f7250acda0a9e906fd009174b762ca5b0ccc4 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Fri, 21 Apr 2017 17:08:00 +0100 Subject: [PATCH] Test another different code path for skipped external entity --- expat/tests/runtests.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index edf9df5b..58fb7071 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -4892,6 +4892,27 @@ START_TEST(test_skipped_null_loaded_ext_entity) } END_TEST +START_TEST(test_skipped_unloaded_ext_entity) +{ + const char *text = + "\n" + ""; + ExtHdlrData test_data = { + "\n" + "\n" + "%pe2;\n", + NULL + }; + + XML_SetUserData(parser, &test_data); + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_oneshot_loader); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + /* @@ -8385,6 +8406,7 @@ make_suite(void) tcase_add_test(tc_basic, test_standalone_internal_entity); tcase_add_test(tc_basic, test_skipped_external_entity); tcase_add_test(tc_basic, test_skipped_null_loaded_ext_entity); + tcase_add_test(tc_basic, test_skipped_unloaded_ext_entity); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace, -- 2.40.0