Extend tests/README (trailing `:' in test scripts)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 26 Apr 2010 08:46:43 +0000 (10:46 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 12 Jun 2010 09:02:25 +0000 (11:02 +0200)
* tests/README (section "Writing test cases" subsection "Do"):
Explain why apparently redundant trailing `:' and `Exit 0' in
test scripts can indeed be useful.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
tests/README

index c2d62cfbe5362a5a1faf1b742c5c8ede6aa97b02..3c25fb92e5b789f2b7e026d32d5942f46e760428 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Extend tests/README w.r.t. trailing `:' in test scripts.
+       * tests/README (section "Writing test cases" subsection "Do"):
+       Explain why apparently redundant trailing `:' and `Exit 0' in
+       test scripts can indeed be useful.
+
 2010-06-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Improve determination of PATH separator in bootstrap script.
index 095d17691560b9463f1a5ebaa55ac9e056bc71e7..7d74083c60cd59cc366432eddb694178904c3845 100644 (file)
@@ -111,6 +111,13 @@ Do
 
   Use `set -e' to catch failures you might not have thought of.
 
+  End the test script with a `:' or `Exit 0'.  Otherwise, when somebody
+  changes the test by adding a failing command after the last command,
+  the test will spuriously fail because $? is nonzero at the end.
+  Note that this is relevant also for tests using `set -e', if they
+  contain commands like "grep ... Makefile.in && Exit 1" (and there
+  are indeed a lot of such tests).
+
   Use $ACLOCAL, $AUTOMAKE, $AUTOCONF, $AUTOUPDATE, $AUTOHEADER,
   $PERL, $MAKE, $EGREP, and $FGREP, instead of the corresponding
   commands.