2008-08-18 Eric Blake <ebb9@byu.net>
+ Test m4_transform without tickling shell bugs.
+ * tests/m4sh.at (AS@&t@_IF and AS@&t@_CASE): Relax test to
+ something more manageable.
+ * tests/m4sugar.at (recursion): Move stress test of
+ m4_transform_pair here.
+ Reported by Ralf Wildenhues.
+
Let 'git diff' give better context for doc updates.
* .gitattributes (*.texi*): Add new entry.
* README-hacking: Mention how to use it.
AT_SETUP([AS@&t@_IF and AS@&t@_CASE])
-AT_KEYWORDS([m4@&t@_foreach_pair])
+AT_KEYWORDS([m4@&t@_transform_pair])
AT_DATA_M4SH([script.as], [[dnl
AS_INIT
]])
dnl stress test for large number of conditionals
+dnl too large, and we start tickling shell bugs
+m4_pushdef([limit], [100])dnl
AT_DATA_M4SH([script.as], [[dnl
AS_INIT
-AS_IF(m4_shift(m4_for([i], [1], [1000], [], [, test $[1] = i, echo i])))
-AS_IF(m4_shift(m4_for([i], [1], [1000], [], [, test $[1] = i, echo i])),
+AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i])))
+AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i])),
[echo default])
-AS_CASE([$[1]]m4_for([i], [1], [1000], [], [, i, echo i]))
-AS_CASE([$[1]]m4_for([i], [1], [1000], [], [, i, echo i]), [echo default])
+AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]))
+AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]), [echo default])
]])
AT_CHECK_M4SH
1
1
]])
-AT_CHECK([./script 1000], [0], [[1000
-1000
-1000
-1000
-]])
+AT_CHECK([./script limit], [0], [limit
+limit
+limit
+limit
+])
AT_CHECK([./script default], [0], [[default
default
]])
+m4_popdef([limit])
AT_CLEANUP
AT_KEYWORDS([m4@&t@_foreach m4@&t@_foreach_w m4@&t@_case m4@&t@_cond
m4@&t@_bpatsubsts m4@&t@_shiftn m4@&t@_do m4@&t@_dquote_elt m4@&t@_reverse
m4@&t@_map m4@&t@_join m4@&t@_joinall m4@&t@_list_cmp m4@&t@_max m4@&t@_min
-m4@&t@_bmatch])
+m4@&t@_bmatch m4@&t@_transform m4@&t@_transform_pair])
dnl This test completes in a reasonable time if m4_foreach is linear,
dnl but thrashes if it is quadratic. If we are testing with m4 1.4.x,
m4_bmatch([9997]m4_for([i], [1], [10000], [], [,^i$]))
m4_define([up], [m4_define([$1], m4_incr($1))$1])m4_define([j], 0)dnl
m4_cond(m4_for([i], [1], [10000], [], [[up([j])], [9990], i,]) [oops]) j
+m4_count(m4_transform_pair([,m4_quote], []m4_transform([,m4_echo]m4_for([i],
+ [1], [10000], [], [,i]))))
m4_divert_pop(0)
]])
A
^9998$
9990 9990
+5001
]])
AT_DATA_M4SUGAR([script.4s],
A
^9998$
9990 9990
+5001
m4_exit([0])])
m4_init
m4_divert_push(0)[]dnl
m4_bmatch([9997]m4_for([i], [1], [10000], [], [,^i$]))
m4_define([up], [m4_define([$1], m4_incr($1))$1])m4_define([j], 0)dnl
m4_cond(m4_for([i], [1], [10000], [], [[up([j])], [9990], i,]) [oops])
+m4_count(m4_transform_pair([,m4_quote], []m4_transform([,m4_echo]m4_for([i],
+ [1], [10000], [], [,i]))))
m4_divert_pop(0)
]])
A
^9998$
9990 9990
+5001
]])
AT_CLEANUP