From: Rhodri James Date: Tue, 13 Jun 2017 18:14:21 +0000 (+0100) Subject: Refactor test_pi_handled_in_default to use accumulate_characters() X-Git-Tag: R_2_2_3~22^2~65 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6822bea9858d3f08875ed30915385a903819dc8c;p=libexpat Refactor test_pi_handled_in_default to use accumulate_characters() --- diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 12ca1c08..7efad19a 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -5241,22 +5241,21 @@ default_matching_handler(void *userData, START_TEST(test_pi_handled_in_default) { -#define PI_TEXT "" - const char *text = PI_TEXT "\n"; - char pi_text[] = PI_TEXT; + const char *text = "\n"; + const XML_Char *expected = "\n"; + CharData storage; - XML_SetDefaultHandler(parser, default_matching_handler); - XML_SetUserData(parser, pi_text); - dummy_handler_flags = 0; + CharData_Init(&storage); + XML_SetDefaultHandler(parser, accumulate_characters); + XML_SetUserData(parser, &storage); if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE)== XML_STATUS_ERROR) xml_failure(parser); - if (dummy_handler_flags != DUMMY_DEFAULT_HANDLER_FLAG) - fail("Processing instruction not picked up by default handler"); + CharData_CheckXMLChars(&storage, expected); } -#undef PI_TEXT END_TEST + /* Test that comments are picked up by a default handler */ START_TEST(test_comment_handled_in_default) {