From 3137798629f1bfd2f193c49e25dcfe3a36356989 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 29 Sep 2019 20:17:38 +0200 Subject: [PATCH] runtests.c: Fix for -DEXPAT_NS=OFF --- expat/tests/runtests.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 88a45de4..2c951f50 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -7053,17 +7053,39 @@ END_TEST /* Test that too many colons are rejected */ START_TEST(test_ns_double_colon) { const char *text = ""; - - expect_failure(text, XML_ERROR_INVALID_TOKEN, - "Double colon in attribute name not faulted"); + const enum XML_Status status + = _XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE); +#ifdef XML_NS + if ((status == XML_STATUS_OK) + || (XML_GetErrorCode(g_parser) != XML_ERROR_INVALID_TOKEN)) { + fail("Double colon in attribute name not faulted" + " (despite active namespace support)"); + } +#else + if (status != XML_STATUS_OK) { + fail("Double colon in attribute name faulted" + " (despite inactive namespace support"); + } +#endif } END_TEST START_TEST(test_ns_double_colon_element) { const char *text = ""; - - expect_failure(text, XML_ERROR_INVALID_TOKEN, - "Double colon in element name not faulted"); + const enum XML_Status status + = _XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE); +#ifdef XML_NS + if ((status == XML_STATUS_OK) + || (XML_GetErrorCode(g_parser) != XML_ERROR_INVALID_TOKEN)) { + fail("Double colon in element name not faulted" + " (despite active namespace support)"); + } +#else + if (status != XML_STATUS_OK) { + fail("Double colon in element name faulted" + " (despite inactive namespace support"); + } +#endif } END_TEST -- 2.40.0