diff options
author | Roy Marples <roy@marples.name> | 2009-02-23 09:35:57 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2009-02-23 09:35:57 +0000 |
commit | 749938d4399c2fdd338670b5a1010474f85ecee6 (patch) | |
tree | 9f1b7d6d1d2a874beb7a1109c1f98931ffbb67f5 /src/test/units | |
parent | 70d8c5bedae21c91187b2b416ca18dff67f42cb1 (diff) |
Style.
Diffstat (limited to 'src/test/units')
-rwxr-xr-x | src/test/units/is_older_than | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/test/units/is_older_than b/src/test/units/is_older_than index e3df7805..7737f5fd 100755 --- a/src/test/units/is_older_than +++ b/src/test/units/is_older_than @@ -14,13 +14,16 @@ TMPDIR=tmp-"$(basename "$0")" # the reference file # # EXAMPLE: if is_older_than a.out *.o ; then ... -ref_is_older_than() { +ref_is_older_than() +{ local x= ref="$1" shift for x; do [ "${x}" -nt "${ref}" ] && return 0 - [ -d "${x}" ] && ref_is_older_than "${ref}" "${x}"/* && return 0 + if [ -d "${x}" ]; then + ref_is_older_than "${ref}" "${x}"/* && return 0 + fi done return 1 } @@ -28,7 +31,8 @@ ref_is_older_than() { rm -rf "${TMPDIR}" mkdir "${TMPDIR}" -do_test() { +do_test() +{ local r1= r2= ref_is_older_than "$@" @@ -40,13 +44,15 @@ do_test() { [ $r1 = $r2 ] } -echo_cmd() { +echo_cmd() +{ [ -n "${VERBOSE}" ] && echo "$@" "$@" } -test_it() { - do_test "${TMPDIR}"/ref "${TMPDIR}"/dir1 "${TMPDIR}"/dir2 || exit 1 +test_it() +{ + do_test "${TMPDIR}"/ref "${TMPDIR}"/dir1 "${TMPDIR}"/dir2 } echo_cmd mkdir -p "${TMPDIR}"/dir1 "${TMPDIR}"/dir2 |