summaryrefslogtreecommitdiff
path: root/tests/pcre-z
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-11-29 17:06:11 +0100
committerJim Meyering <meyering@redhat.com>2011-11-29 17:06:50 +0100
commit5f2a03af5258eabb1263e58229fd4d1f395ca14a (patch)
treecf89f94c7a33bfbcccadbedb893a9b6f9a861a0d /tests/pcre-z
parent8798244b1f23c7df8db079747308c1417254a0ca (diff)
downloadgrep-5f2a03af5258eabb1263e58229fd4d1f395ca14a.tar.gz
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/(compare) (\S+) (exp\S*)/$1 $3 $2/' git grep -l -E 'compare [^ ]+ /dev/null' \ |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/'
Diffstat (limited to 'tests/pcre-z')
-rwxr-xr-xtests/pcre-z8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/pcre-z b/tests/pcre-z
index 169c44e8..99ebc43c 100755
--- a/tests/pcre-z
+++ b/tests/pcre-z
@@ -8,16 +8,16 @@ REGEX=a
printf "%s\n0" abc def ghi aaa gah | tr 0 \\0 > in
grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep -z) match.'
-compare err /dev/null || fail_ 'stderr not empty on grep -z.'
+compare /dev/null err || fail_ 'stderr not empty on grep -z.'
# Sanity check the output
test "$(grep -cz $REGEX in 2>err)" = 3 \
|| fail_ 'Incorrect BRE (grep -cz) match.'
-compare err /dev/null || fail_ 'stderr not empty on grep -cz.'
+compare /dev/null err || fail_ 'stderr not empty on grep -cz.'
fail=0
grep -Pz "$REGEX" in > out 2>err || fail=1
-compare out exp || fail=1
-compare err /dev/null || fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1
Exit $fail