Re: expat/tests runtests.c,1.43,1.44
"Fred L. Drake, Jr." <[email protected]>
| Newsgroups | gmane.text.xml.expat.cvs |
|---|---|
| Message-ID | <[email protected]> |
Karl Waclawek writes: > I am confused now - I never saw a test case that checks that > Jeremy's document is in error. That's a modified version of the test attached to the issue on SF. > Your two test cases so far, check that: > - default namespace can be empty, > - xmlns:prefix='' is allowed when namespace processing is turned off Those are tests that pass and are already checked in. Those are fine before and after the patch. > Am I right? > Now, we need a test case that checks that xmlns:prefix='' is > an error when namespace processing is on. This newest test case > above seems to be the one. > > What do you mean with : this test fails? > I mean: Expat should return an error and the test case should > expect that error. Are you saying that in the above test case, > Expat does *not* return an error? That's right; the test expects and error and does not get one, so it reports a failure (that Expat did not report the error). I've attached my current version of the new tests. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation _______________________________________________ Expat-checkins mailing list [email protected] http://mail.libexpat.org/mailman/listinfo/expat-checkins
new-tests.diff
(text/plain, 1.6 KB)
Index: tests/runtests.c
===================================================================
RCS file: /cvsroot/expat/expat/tests/runtests.c,v
retrieving revision 1.45
diff -u -d -r1.45 runtests.c
--- tests/runtests.c 24 Jan 2003 05:39:16 -0000 1.45
+++ tests/runtests.c 24 Jan 2003 17:00:00 -0000
@@ -1163,6 +1163,34 @@
}
END_TEST
+/* Regression test #1 for SF bug #673791. */
+START_TEST(test_ns_prefix_with_empty_uri_1)
+{
+ char *text =
+ "<doc xmlns:prefix='http://xml.libexpat.org/'>\n"
+ " <e xmlns:prefix=''/>\n"
+ "</doc>";
+
+ expect_failure(text,
+ XML_ERROR_SYNTAX,
+ "Did not report re-setting namespace"
+ " URI with prefix to ''.");
+}
+END_TEST
+
+/* Regression test #2 for SF bug #673791. */
+START_TEST(test_ns_prefix_with_empty_uri_2)
+{
+ char *text =
+ "<?xml version='1.0'?>\n"
+ "<docelem xmlns:pre=''/>";
+
+ expect_failure(text,
+ XML_ERROR_SYNTAX,
+ "Did not report setting namespace URI with prefix to ''.");
+}
+END_TEST
+
START_TEST(test_ns_default_with_empty_uri)
{
char *text =
@@ -1230,6 +1258,8 @@
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_prefix_with_empty_uri_1);
+ tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2);
tcase_add_test(tc_namespace, test_ns_default_with_empty_uri);
return s;