[Expat-checkins] expat/tests runtests.c,1.23,1.24

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Tue Jul 9 14:18:08 2002


Update of /cvsroot/expat/expat/tests
In directory usw-pr-cvs1:/tmp/cvs-serv25451

Modified Files:
	runtests.c 
Log Message:
Add a test for SF bug #478332.
If I understand the report correctly, I can't reproduce the bug using
the CVS version of Expat.


Index: runtests.c
===================================================================
RCS file: /cvsroot/expat/expat/tests/runtests.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- runtests.c	28 Jun 2002 23:04:49 -0000	1.23
+++ runtests.c	9 Jul 2002 21:17:45 -0000	1.24
@@ -284,6 +284,41 @@
 }
 END_TEST
 
+/* Regression test for SF bug #478332. */
+START_TEST(test_really_long_lines)
+{
+    /* This parses an input line longer than INIT_DATA_BUF_SIZE
+       characters long (defined to be 1024 in xmlparse.c).  We take a
+       really cheesy approach to building the input buffer, because
+       this avoids writing bugs in buffer-filling code.
+    */
+    char *text =
+        "<e>"
+        /* 64 chars */
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        /* until we have at least 1024 characters on the line: */
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
+        "</e>";
+    if (!XML_Parse(parser, text, strlen(text), 1))
+        xml_failure(parser);
+}
+END_TEST
+
 
 /*
  * Element event tests.
@@ -626,6 +661,7 @@
     tcase_add_test(tc_chars, test_french_latin1);
     tcase_add_test(tc_chars, test_french_utf8);
     tcase_add_test(tc_chars, test_line_count);
+    tcase_add_test(tc_chars, test_really_long_lines);
 
     suite_add_tcase(s, tc_elements);
     tcase_add_checked_fixture(tc_elements, basic_setup, basic_teardown);