]> git.draconx.ca Git - cdecl99.git/blobdiff - tests/stress.at
libcdecl: Fix parsing of very long declarator lists.
[cdecl99.git] / tests / stress.at
index 40e8812e1716a9b64c4f439cba78faac7ce8e800..605a69ac27b6c3ebe2f047130df5476fa2c90003 100644 (file)
@@ -125,3 +125,44 @@ inline int f()
 ]])
 
 AT_CLEANUP
+
+# Check that we can parse declarations with more than 10000 declarators.
+AT_SETUP([Excessive declarators])
+
+AT_DATA([check.awk],
+[[# We don't need any field splitting, so choose a character that does not
+# appear in C code to avoid tripping over 199-field limit in HP-UX 11 awk.
+BEGIN { FS = "@"; runstart = 0; }
+END { finish_run(NR); }
+
+$0 != lastline {
+  finish_run(NR-1);
+  lastline = $0;
+  runstart = NR;
+  print;
+}
+
+function finish_run(nr) {
+  count = nr - runstart;
+  if (count > 0)
+    print "[repeated " count " more times]";
+}
+]])
+
+a="a"
+for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
+  AS_VAR_APPEND([a], [",$a"])
+done
+
+cat >test.dat <<EOF
+explain int $a
+EOF
+
+AT_CHECK([cdecl99 -f test.dat >test.out; status=$?;
+$AWK -f check.awk test.out
+exit $status], [0],
+[[declare a as int
+[repeated 16383 more times]
+]])
+
+AT_CLEANUP