diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2011-10-10 10:12:51 +0100 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2011-10-10 10:33:54 +0100 |
commit | c14b45f70cc1cac1cca46af30c0c9c7aa32b459f (patch) | |
tree | c4146b06b4943c2e23a941c275a7553cbb245520 /tests | |
parent | cdb2882dc33b7bd1ee3fba2190cc17fef324050d (diff) | |
download | tbdiff-c14b45f70cc1cac1cca46af30c0c9c7aa32b459f.tar.gz |
libtbd_create now fails if target directory has a socket.
tbdiff-create will print a suggested fix
Made check_command shell function able to use any type of command
for return value checking
Fixed minor bugs in TBD_ERROR macro not being used for some errors
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_lib.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_lib.sh b/tests/test_lib.sh index 5112cea..e95759d 100644 --- a/tests/test_lib.sh +++ b/tests/test_lib.sh @@ -41,9 +41,9 @@ check_group () { test $(stat -c %G $1) = $2 } -#declare -f is faster, but won't work in dash -is_function () { - type $1 2>/dev/null | grep 'function' +# tests whether a command exists +is_command () { + type $1 >/dev/null 2>/dev/null } #check_command COMMAND_STRING TEST_COMMAND COMMAND_DESCRIPTION @@ -53,7 +53,7 @@ check_command () { COMMAND_DESCRIPTION="$3" eval $COMMAND_STRING RETVAL=$? - if is_function "$TEST_COMMAND"; then #test explicitly checks return + if is_command "$TEST_COMMAND"; then #test explicitly checks return if $TEST_COMMAND $RETVAL; then if [ "$RETVAL" != "0" ]; then echo $COMMAND_STRING expected failure in \ |