[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: use "compare exp out", not "compare out exp"
From: |
Jim Meyering |
Subject: |
[PATCH] tests: use "compare exp out", not "compare out exp" |
Date: |
Tue, 29 Nov 2011 18:18:15 +0100 |
FYI,
>From d3cd190bdbd88c83fd1487c43d268a5fb1df76a2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 29 Nov 2011 18:14:02 +0100
Subject: [PATCH] tests: use "compare exp out", not "compare out exp"
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 | 2 +-
tests/mixed | 8 ++++----
tests/null-suffix-clobber | 4 ++--
tests/trailing-nul | 2 +-
tests/zdiff | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/helin-segv b/tests/helin-segv
index 92c4ab4..22c79db 100755
--- a/tests/helin-segv
+++ b/tests/helin-segv
@@ -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
diff --git a/tests/mixed b/tests/mixed
index 22913df..982378d 100644
--- a/tests/mixed
+++ b/tests/mixed
@@ -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
diff --git a/tests/null-suffix-clobber b/tests/null-suffix-clobber
index 44c6d50..0fff50c 100755
--- a/tests/null-suffix-clobber
+++ b/tests/null-suffix-clobber
@@ -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
diff --git a/tests/trailing-nul b/tests/trailing-nul
index 8a6a4f1..988968d 100755
--- a/tests/trailing-nul
+++ b/tests/trailing-nul
@@ -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
diff --git a/tests/zdiff b/tests/zdiff
index 3891652..25f82c5 100755
--- a/tests/zdiff
+++ b/tests/zdiff
@@ -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
--
1.7.8.rc4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tests: use "compare exp out", not "compare out exp",
Jim Meyering <=