From 507c2e5c9b120a6c6bff478e922c19a45832ed6c Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Fri, 10 Mar 2017 19:12:06 +0000 Subject: [PATCH] Test deeply-nested groups --- expat/tests/runtests.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 8ebfc8ef..e9bc6181 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -4199,6 +4199,37 @@ START_TEST(test_public_notation_no_sysid) } END_TEST +static void XMLCALL +record_element_start_handler(void *userData, + const XML_Char *name, + const XML_Char **UNUSED_P(atts)) +{ + CharData_AppendString((CharData *)userData, name); +} + +START_TEST(test_nested_groups) +{ + const char *text = + "\n" + "" + "]>\n" + ""; + CharData storage; + + CharData_Init(&storage); + XML_SetStartElementHandler(parser, record_element_start_handler); + XML_SetUserData(parser, &storage); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckString(&storage, "doce"); +} +END_TEST /* * Namespaces tests. @@ -7183,6 +7214,7 @@ make_suite(void) tcase_add_test(tc_basic, test_predefined_entity_redefinition); tcase_add_test(tc_basic, test_dtd_stop_processing); tcase_add_test(tc_basic, test_public_notation_no_sysid); + tcase_add_test(tc_basic, test_nested_groups); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace,