I've just pushed this:
From 676f6b24d8aed74e7c1b1cc6a122dfdba265c8f2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Sun, 30 Oct 2016 12:16:42 -0700
Subject: [PATCH] maint: use "returns_" rather than explicit comparison with
"$?"
* tests/zdiff: Use "returns_ 1" rather than testing $? = 1.
* tests/hufts: Likewise.
* tests/timestamp: Likewise, but s/1/2/.
---
tests/hufts | 3 +--
tests/timestamp | 6 ++----
tests/zdiff | 3 +--
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/tests/hufts b/tests/hufts
index 5832a21..1793b89 100755
--- a/tests/hufts
+++ b/tests/hufts
@@ -23,8 +23,7 @@ printf '\n...: invalid compressed data--format violated\n' >
exp \
|| framework_failure_
fail=0
-gzip -dc "$abs_srcdir/hufts-segv.gz" > out 2> err
-test $? = 1 || fail=1
+returns_ 1 gzip -dc "$abs_srcdir/hufts-segv.gz" > out 2> err || fail=1
compare /dev/null out || fail=1
diff --git a/tests/timestamp b/tests/timestamp
index 141c1d4..765e33d 100755
--- a/tests/timestamp
+++ b/tests/timestamp
@@ -26,8 +26,7 @@ export TZ
# test that gzip warns when converting them to gzip format.
for time in 190101010000 196912312359.59 197001010000 210602070628.16; do
if touch -t $time in; then
- gzip in
- test $? = 2 || fail=1
+ returns_ 2 gzip in || fail=1
fi
rm -f in.gz in
done
@@ -45,8 +44,7 @@ done
touch -t 210602070628.15 in || {
printf '\037\213\10\0\377\377\377\377\0\377\3\0\0\0\0\0\0\0\0\0' >y2106.gz ||
framework_failure_
- gzip -Nlv <y2106.gz
- test $? = 2 || fail=1
+ returns_ 2 gzip -Nlv <y2106.gz || fail=1
}
# Ensure that --no-name does not provoke a time stamp warning.
diff --git a/tests/zdiff b/tests/zdiff
index 0bb7c7d..eee47b3 100755
--- a/tests/zdiff
+++ b/tests/zdiff
@@ -32,8 +32,7 @@ cat <<EOF > exp
EOF
fail=0
-zdiff a.gz b.gz > out 2>&1
-test $? = 1 || fail=1
+returns_ 1 zdiff a.gz b.gz > out 2>&1 || fail=1
compare exp out || fail=1
--
2.8.0-rc2