maint: use "returns_" rather than explicit comparison with "$?"
authorJim Meyering <meyering@fb.com>
Sun, 30 Oct 2016 19:16:42 +0000 (12:16 -0700)
committerJim Meyering <meyering@fb.com>
Wed, 9 Nov 2016 02:30:23 +0000 (18:30 -0800)
* tests/zdiff: Use "returns_ 1" rather than testing $? = 1.
* tests/hufts: Likewise.
* tests/timestamp: Likewise, but s/1/2/.

tests/hufts
tests/timestamp
tests/zdiff

index 5832a21845455402498530aeaa4b16fff87ba011..1793b89a73bdbc9ff3990c525639787685b16f2c 100755 (executable)
@@ -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
 
index 141c1d4dcc029e2d851f3d8dfdad029f08d871bc..765e33d5617ec245370a00919a4b692518bd9290 100755 (executable)
@@ -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.
index 0bb7c7dfdcf93ecd2614521a941a962871465907..eee47b371f380da0396fe1221eebd59e51084a7f 100755 (executable)
@@ -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