tests: unpack-invalid: correct and clean up a test
authorJim Meyering <meyering@fb.com>
Thu, 9 Nov 2017 15:39:58 +0000 (07:39 -0800)
committerJim Meyering <meyering@fb.com>
Thu, 9 Nov 2017 15:39:58 +0000 (07:39 -0800)
* tests/unpack-invalid: There was a logic error that would have
caused this test to ignore a failure if first iteration of the
loop set fail=1 and the second one reset it to 0.  Also, use
"returns_ 1 ...", to require an exit status of 1.

tests/unpack-invalid

index d3035f12d50b9f90bc352d0fc30febb7429b578b..396c7e6b6c019df86d2ce47d46f99e5dfe71a6f6 100755 (executable)
 
 . "${srcdir=.}/init.sh"; path_prepend_ ..
 
+fail=0
 for input in \
   '\037\036\000\000\037\213\010\000\000\000\000\000\002\003\036\000\000\000\002\003\037\213\010\000\000\000\000\000\002\003\355\301\001\015\000\000\000\302\240\037\000\302\240\037\213\010\000\000\000\000\000\002\003\355\301' \
   '\037\213\010\000\000\000\000\000\002\003\355\301\001\015\000\000\000\302\240\076\366\017\370\036\016\030\000\000\000\000\000\000\000\000\000\034\010\105\140\104\025\020\047\000\000\037\036\016\030\000\000\000'; do
 
   printf "$input" >in || framework_failure_
-
-  if gzip -d <in >out 2>err; then
-    fail=1
-  else
-    fail=0
-  fi
+  returns_ 1 gzip -d <in >out 2>err || fail=1
 done
 
 Exit $fail