test-init.sh: correct the test for diff -u
authorBruno Haible <bruno@clisp.org>
Fri, 6 Jan 2012 08:21:29 +0000 (09:21 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 6 Jan 2012 10:07:08 +0000 (11:07 +0100)
* tests/test-init.sh: Also redirect stdout to /dev/null.

ChangeLog
tests/test-init.sh

index 781e400..2cb3956 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-06  Bruno Haible  <bruno@clisp.org>
+
+       test-init.sh: correct the test for diff -u
+       * tests/test-init.sh: Also redirect stdout to /dev/null.
+
 2012-01-05  Paul Eggert  <eggert@cs.ucla.edu>
 
        Use ', not `, for quoting output.
index 1ed1b79..3368a99 100755 (executable)
@@ -62,8 +62,8 @@ EOF
 EOF
   sed 's/      .*//;/^@@/d' out > k && mv k out
 
-  # Check the expected output only if compare is using diff -u.
-  if $(exec 2>/dev/null; diff -u out out < /dev/null); then
+  # Compare against expected output only if compare is using diff -u.
+  if (diff -u out out < /dev/null) > /dev/null 2>&1; then
     compare exp out || fail=1
   fi
   case $- in *x*) ;; *) test -s err && fail_ "err not empty: $(cat err)";; esac