[Expat-checkins] expat/tests runtests.c,1.24,1.25
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Mon Jul 22 10:16:08 2002
Update of /cvsroot/expat/expat/tests
In directory usw-pr-cvs1:/tmp/cvs-serv26697
Modified Files:
runtests.c
Log Message:
Added regression test for SF bug #584832, adapted from contributed
test.
Index: runtests.c
===================================================================
RCS file: /cvsroot/expat/expat/tests/runtests.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- runtests.c 9 Jul 2002 21:17:45 -0000 1.24
+++ runtests.c 22 Jul 2002 17:15:48 -0000 1.25
@@ -481,6 +481,35 @@
}
END_TEST
+/* Regression test for SF bug #584832. */
+static int
+UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info)
+{
+ if (strcmp(encoding,"unsupported-encoding") == 0) {
+ int i;
+ for (i = 0; i < 256; ++i)
+ info->map[i] = i;
+ info->data=NULL;
+ info->convert=NULL;
+ info->release=NULL;
+ return 1;
+ }
+ return 0;
+}
+
+START_TEST(test_xmldecl_unknown_encoding_internal_entity)
+{
+ char *text =
+ "<?xml version='1.0' encoding='unsupported-encoding'?>\n"
+ "<!DOCTYPE test [<!ENTITY foo 'bar'>]>\n"
+ "<test a='&foo;'/>";
+
+ XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL);
+ if (!XML_Parse(parser, text, strlen(text), 1))
+ xml_failure(parser);
+}
+END_TEST
+
/*
* Namespaces tests.
@@ -674,6 +703,7 @@
suite_add_tcase(s, tc_xmldecl);
tcase_add_checked_fixture(tc_xmldecl, basic_setup, basic_teardown);
tcase_add_test(tc_xmldecl, test_xmldecl_misplaced);
+ tcase_add_test(tc_xmldecl, test_xmldecl_unknown_encoding_internal_entity);
suite_add_tcase(s, tc_namespace);
tcase_add_checked_fixture(tc_namespace,