[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-patch] [PATCH 06/15] maint: avoid non-portable use of test -a
From: |
Jim Meyering |
Subject: |
[bug-patch] [PATCH 06/15] maint: avoid non-portable use of test -a |
Date: |
Sat, 26 Mar 2011 14:32:01 +0100 |
From: Jim Meyering <address@hidden>
With these changes, "make sc_prohibit_test_minus_ao" almost passes.
Uses of "test -o" remain.
Note: unchecked uses of test -ot/-nt also remain.
* tests/empty-files: Use "test C1 && test C2", not "test C1 -a C2"
* tests/merge: Likewise.
* tests/symlinks: Likewise.
* tests/test-lib.sh: Likewise.
---
tests/empty-files | 4 ++--
tests/merge | 2 +-
tests/symlinks | 2 +-
tests/test-lib.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/empty-files b/tests/empty-files
index 6ac01be..8ca1e13 100644
--- a/tests/empty-files
+++ b/tests/empty-files
@@ -26,7 +26,7 @@ check 'patch < create-empty.diff || echo "Status: $?"' <<EOF
patching file f
EOF
-ncheck 'test -e f -a ! -s f'
+ncheck 'test -e f && test ! -s f'
# --------------------------------------------------------------
# Empty out a file
@@ -46,7 +46,7 @@ check 'patch < empty-out.diff || echo "Status: $?"' <<EOF
patching file f
EOF
-ncheck 'test -e f -a ! -s f'
+ncheck 'test -e f && test ! -s f'
# --------------------------------------------------------------
# Empty out a file and delete it with -E
diff --git a/tests/merge b/tests/merge
index 00b45a4..5aee809 100644
--- a/tests/merge
+++ b/tests/merge
@@ -27,7 +27,7 @@ x2() {
body=`seq 1 $1`
shift
echo "$body" > a
- while test $# -gt 0 -a "$1" != -- ; do
+ while test $# -gt 0 && test "$1" != -- ; do
echo "$1"
shift
done > a.sed
diff --git a/tests/symlinks b/tests/symlinks
index f7dea76..3b7f0e2 100644
--- a/tests/symlinks
+++ b/tests/symlinks
@@ -147,7 +147,7 @@ check 'patch -p1 --backup < create-symlink.diff || echo
"Status: $?"' <<EOF
patching symbolic link symlink
EOF
-ncheck 'test -f symlink.orig -a ! -s symlink.orig'
+ncheck 'test -f symlink.orig && test ! -s symlink.orig'
# The backup file of a modified symlink is the old symlink.
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 2dbfbcd..b3ce900 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -104,7 +104,7 @@ cleanup() {
checks_failed=`expr $checks_failed`
checks_total=`expr $checks_succeeded + $checks_failed`
if test $checks_total -gt 0 ; then
- if test $checks_failed -gt 0 -a $status -eq 0 ; then
+ if test $checks_failed -gt 0 && test $status -eq 0 ; then
status=1
fi
echo "$checks_total tests ($checks_succeeded passed," \
--
1.7.1.354.ge64bd
- [bug-patch] [PATCH 01/15] maint: use gnulib's maintainer-makefile module, (continued)
- [bug-patch] [PATCH 01/15] maint: use gnulib's maintainer-makefile module, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 02/15] maint: arrange for the sc_require_config_h_first test to pass, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 04/15] maint: remove trailing blanks, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 09/15] build: avoid three gcc warnings, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 15/15] build: don't turn off -Wmissing-declarations, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 13/15] maint: remove now-unneeded macro definitions, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 14/15] build: don't turn off -Wmissing-prototypes, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 05/15] maint: allow the sc_prohibit_empty_lines_at_EOF test to pass, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 07/15] build: accept new configure-time option --enable-gcc-warnings, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 06/15] maint: avoid non-portable use of test -a,
Jim Meyering <=
- [bug-patch] [PATCH 11/15] maint: update bootstrap and gnulib submodule, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 12/15] maint: use gnulib's progname module, Jim Meyering, 2011/03/26
- [bug-patch] [PATCH 10/15] maint: update copyright date year ranges to include 2011, Jim Meyering, 2011/03/26
- Re: [bug-patch] [PATCH 00/15] *** SUBJECT HERE ***, Andreas Gruenbacher, 2011/03/26