tests: use "compare exp out", not "compare out exp"
authorJim Meyering <meyering@redhat.com>
Tue, 29 Nov 2011 17:14:02 +0000 (18:14 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 29 Nov 2011 17:14:02 +0000 (18:14 +0100)
Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name.  Prompted by a suggestion from Bruno Haible
in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154

Run these commands:

    git grep -l -E 'compare [^ ]+ exp' \
      |xargs perl -pi -e 's/\b(compare) (\S+) (exp\S*)/$1 $3 $2/'
    git grep -l -E 'compare [^ ]+ /dev/null' \
      |xargs perl -pi -e 's,\b(compare) (\S+) (/dev/null),$1 $3 $2,'

tests/helin-segv
tests/mixed
tests/null-suffix-clobber
tests/trailing-nul
tests/zdiff

index 92c4ab488be1be5b32576b28be35c91c6f950566..22c79db1dc51edc3926f5881707cf88b2983b9c8 100755 (executable)
@@ -26,6 +26,6 @@ printf '\0\0' > exp || framework_failure_
 fail=0
 
 gzip -dc helin.gz > out || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 22913df5781fff32b1a7795d1a8ffcf941c093b8..982378da3be9800d22c1a3608217dc1f1aecbef9 100644 (file)
@@ -27,22 +27,22 @@ fail=0
 
 (echo xxx; echo yyy) > in || fail=1
 gzip -cdf < in > out || fail=1
-compare out exp2 || fail=1
+compare exp2 out || fail=1
 
 # Uncompressed input, followed by compressed data.
 # Currently fails, so skip it.
 # (echo xxx; echo yyy|gzip) > in || fail=1
 # gzip -cdf < in > out || fail=1
-# compare out exp2 || fail=1
+# compare exp2 out || fail=1
 
 # Compressed input, followed by regular (not-compressed) data.
 (echo xxx|gzip; echo yyy) > in || fail=1
 gzip -cdf < in > out || fail=1
-compare out exp2 || fail=1
+compare exp2 out || fail=1
 
 (echo xxx|gzip; echo yyy|gzip) > in || fail=1
 gzip -cdf < in > out || fail=1
-compare out exp2 || fail=1
+compare exp2 out || fail=1
 
 in_str=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-+=%
 for i in 0 1 2 3 4 5 6 7 8 9 a; do in_str="$in_str$in_str" ;done
index 44c6d50e712f57d7b6e8f5e765b006ccb42c37ea..0fff50c0b0504de4560b91a66e4e93a272447558 100755 (executable)
@@ -27,8 +27,8 @@ fail=0
 
 gzip ---presume-input-tty -d -S '' F.gz < yes > out 2>err && fail=1
 
-compare out /dev/null || fail=1
-compare err expected-err || fail=1
+compare /dev/null out || fail=1
+compare expected-err err || fail=1
 
 test -f F.gz || fail=1
 
index 8a6a4f16f139bc2f6cd1dcb5061e4800bce1c2d0..988968db745f68c70ff7b023e7bdaa32e1e19c8e 100755 (executable)
@@ -31,7 +31,7 @@ for i in 0 00 1; do
   test $ret -eq $i || fail=1
   test $ret = 1 && continue
   echo $i > exp || fail=1
-  compare $i exp || fail=1
+  compare exp $i || fail=1
 done
 
 Exit $fail
index 3891652b54b5335a88ce90f66e84cbdc41d76bfc..25f82c5d21d46073576a610fbe2a5e26d88e9e18 100755 (executable)
@@ -35,7 +35,7 @@ fail=0
 zdiff a.gz b.gz > out 2>&1
 test $? = 1 || fail=1
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 rm -f out
 # expect success, for equal files