expat/tests runtests.c,1.44,1.45

"Fred L. Drake" <[email protected]>
Newsgroups gmane.text.xml.expat.cvs
Message-ID <[email protected]>
Update of /cvsroot/expat/expat/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv26377

Modified Files:
	runtests.c 
Log Message:
- _expect_failure():  Use _fail_unless() instead of fail() to allow
  reporting of the right line number
- add test that demonstrates the default namespace can be reset
  without a syntax error


Index: runtests.c
===================================================================
RCS file: /cvsroot/expat/expat/tests/runtests.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- runtests.c	24 Jan 2003 05:09:42 -0000	1.44
+++ runtests.c	24 Jan 2003 05:39:16 -0000	1.45
@@ -50,7 +50,9 @@
                 char *file, int lineno)
 {
     if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_OK)
-        fail(errorMessage);
+        /* Hackish use of _fail_unless() macro, but let's us report
+           the right filename and line number. */
+        _fail_unless(0, file, lineno, errorMessage);
     if (XML_GetErrorCode(parser) != errorCode)
         _xml_failure(parser, file, lineno);
 }
@@ -1161,6 +1163,17 @@
 }
 END_TEST
 
+START_TEST(test_ns_default_with_empty_uri)
+{
+    char *text =
+        "<doc xmlns='http://xml.libexpat.org/'>\n"
+        "  <e xmlns=''/>\n"
+        "</doc>";
+    if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
 static Suite *
 make_basic_suite(void)
 {
@@ -1217,6 +1230,7 @@
     tcase_add_test(tc_namespace, test_ns_tagname_overwrite_triplet);
     tcase_add_test(tc_namespace, test_start_ns_clears_start_element);
     tcase_add_test(tc_namespace, test_default_ns_from_ext_subset_and_ext_ge);
+    tcase_add_test(tc_namespace, test_ns_default_with_empty_uri);
 
     return s;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.