]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
autotest: work around zsh bug
authorEric Blake <eblake@redhat.com>
Mon, 13 Sep 2010 17:31:23 +0000 (11:31 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 13 Sep 2010 19:28:35 +0000 (13:28 -0600)
* lib/autotest/general.m4 (AT_DATA): Special case an empty data
file, since zsh botches empty here-docs.
* doc/autoconf.texi (Writing Testsuites) <AT_DATA>: Document that
this allows empty contents.
* tests/autotest.at (AT_DATA): New test.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/autoconf.texi
lib/autotest/general.m4
tests/autotest.at

index 3fc150b5662c7df883c01119f852ac1511a1f14b..fac4c15bf4c15a9a42045496956c8b0e617c56c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-09-13  Eric Blake  <eblake@redhat.com>
 
+       autotest: work around zsh bug
+       * lib/autotest/general.m4 (AT_DATA): Special case an empty data
+       file, since zsh botches empty here-docs.
+       * doc/autoconf.texi (Writing Testsuites) <AT_DATA>: Document that
+       this allows empty contents.
+       * tests/autotest.at (AT_DATA): New test.
+       Reported by Ralf Wildenhues.
+
        docs: mention gnulib portability docs
        * doc/autoconf.texi (Function Portability, Header Portability):
        Add external links to gnulib.
index 30fcb19de6b86c8296e100717058f532005dbec6..8471525923652cace355d1abbe09dac5aa6dc265 100644 (file)
@@ -24193,7 +24193,8 @@ End the current test group.
 Initialize an input data @var{file} with given @var{contents}.  Of
 course, the @var{contents} have to be properly quoted between square
 brackets to protect against included commas or spurious M4
-expansion.  The contents must end with an end of line.  @var{file} must
+expansion.  @var{contents} must be empty or end with a newline.
+@var{file} must
 be a single shell word that expands into a single file name.
 @end defmac
 
index cdc82b9a870356f09a8153ea234a6c6e1b07bba8..78f1cc6166b7b1b540740b3202177ee17035a85b 100644 (file)
@@ -1947,14 +1947,16 @@ at_banner_text_[]AT_banner_ordinal="AS_ESCAPE([$1])"])dnl
 
 # AT_DATA(FILE, CONTENTS)
 # -----------------------
-# Initialize an input data FILE with given CONTENTS, which should end with
-# an end of line.
+# Initialize an input data FILE with given CONTENTS, which should be
+# empty or end with a newline.
 # This macro is not robust to active symbols in CONTENTS *on purpose*.
 # If you don't want CONTENTS to be evaluated, quote it twice.
 _AT_DEFINE_SETUP([AT_DATA],
+[m4_if([$2], [], [: >$1],
+       [$2], [[]], [: >$1],
 [cat >$1 <<'_ATEOF'
 $2[]_ATEOF
-])
+])])
 
 
 # AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR,
index ab04dbe0b03c2be23a136537abd8c6386cb34c41..323006e030ef2d2bd8fd439ea4a8b8b79c2eeb37 100644 (file)
@@ -159,6 +159,25 @@ AT_CHECK([sed 50q micro-suite | grep 'This is just a test notice'],
 [--version])
 
 
+## --------- ##
+## AT_DATA.  ##
+## --------- ##
+
+AT_CHECK_AT_TEST([AT@&t@_DATA], [
+AT_CHECK([test -f file1], [1])
+AT_DATA([file1])
+AT_CHECK([test -f file1 && test ! -s file1])
+AT_CHECK([echo hi > file1])
+AT_DATA([file1], [[]])
+AT_CHECK([test -f file1 && test ! -s file1])
+file=file2
+AT_DATA([$file], [[$file
+]])
+AT_CHECK([echo '$file' > file3])
+AT_CHECK([cmp file2 file3])
+])
+
+
 ## ------------------ ##
 ## Empty test suite.  ##
 ## ------------------ ##