2010-07-02 Eric Blake <eblake@redhat.com>
+ Add tests for AS_BOX.
+ * tests/m4sugar.at (m4@&t@_text_box): New test.
+ * tests/m4sh.at (AS@&t@_BOX): Likewise.
+ * lib/m4sugar/m4sugar.m4 (m4_text_box): Support comma.
+ * doc/autoconf.texi (Text processing Macros) <m4_text_box>:
+ Document further limitations.
+
Add optional argument to AS_LITERAL_IF.
* lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Rewrite to generate macro
name, without using m4_cond.
@defmac m4_text_box (@var{message}, @dvar{frame, -})
@msindex{text_box}
Add a text box around @var{message}, using @var{frame} as the border
-character above and below the message. The frame correctly accounts for
+character above and below the message. The @var{frame} argument must be
+a single byte, and does not support quadrigraphs.
+The frame correctly accounts for
the subsequent expansion of @var{message}. For example:
@example
m4_define([macro], [abc])dnl
AT_CLEANUP
-## ------------- ##
-## AS_BASENAME. ##
-## ------------- ##
+## -------- ##
+## AS_BOX. ##
+## -------- ##
+
+# Output a framed one-line message.
+AT_SETUP([AS@&t@_BOX])
+AT_KEYWORDS([m4sh])
+
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+echo
+AS_BOX([Send a simple message, to foobar@example.com])
+AS_BOX([Send a simple message, to foobar@example.com], [$])
+m4_define([msg], [$complex])
+complex='Not quite as simple |$[1]'
+AS_BOX([msg])
+AS_BOX([msg], [,])
+AS_EXIT(0)
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([sed -n '/ -\{44\} /,/ -\{44\} /p' script ]dnl
+[| sed '1 s/.*## -/## -/; 3 s/- ##.*/- ##/'], [],
+[[## -------------------------------------------- ##
+## Send a simple message, to foobar@example.com ##
+## -------------------------------------------- ##
+]])
+
+AT_CHECK([$CONFIG_SHELL ./script], [], [[
+## -------------------------------------------- ##
+## Send a simple message, to foobar@example.com ##
+## -------------------------------------------- ##
+## $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ##
+## Send a simple message, to foobar@example.com ##
+## $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ##
+## ----------------------- ##
+## Not quite as simple |$1 ##
+## ----------------------- ##
+## ,,,,,,,,,,,,,,,,,,,,,,, ##
+## Not quite as simple |$1 ##
+## ,,,,,,,,,,,,,,,,,,,,,,, ##
+]])
+
+AT_CLEANUP
+
# Strip path from file.
AT_SETUP([AS@&t@_BASENAME])