From f748d87811b77afa5cd856bde5e60a26682b0c57 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Fri, 17 Feb 2017 15:18:34 +0000 Subject: [PATCH] Test rejection of unbound prefix, improve coverage of attribute handling --- expat/tests/runtests.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index f351d2bf..e007bdae 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -3376,6 +3376,25 @@ START_TEST(test_ns_prefix_with_empty_uri_4) } END_TEST +/* Test with non-xmlns prefix */ +START_TEST(test_ns_unbound_prefix) +{ + const char *text = + "\n" + " \n" + "]>\n" + ""; + + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + fail("Unbound prefix incorrectly passed"); + if (XML_GetErrorCode(parser) != XML_ERROR_UNBOUND_PREFIX) + xml_failure(parser); +} +END_TEST + START_TEST(test_ns_default_with_empty_uri) { const char *text = @@ -4595,6 +4614,7 @@ make_suite(void) tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_3); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_4); + tcase_add_test(tc_namespace, test_ns_unbound_prefix); tcase_add_test(tc_namespace, test_ns_default_with_empty_uri); tcase_add_test(tc_namespace, test_ns_duplicate_attrs_diff_prefixes); tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_attribute);