X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=tests%2Flib.sh;h=2f2c736711fc787fb74ca066aac4d3afb68b4cc6;hb=2c55827f6f2c231a8f166e015df4c5c3818c8ba4;hp=27653f760908487ae64d793092daf4d02db00f03;hpb=59375c2b7949791d8cad8e5cebde2649bac83ec8;p=coloredstderr%2Fcoloredstderr.git diff --git a/tests/lib.sh b/tests/lib.sh index 27653f7..2f2c736 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -40,7 +40,10 @@ fi LC_ALL=C unset LANGUAGE -# Set default COLORED_STDERR_FDS value. +# Clear user defined variables. +unset COLORED_STDERR_FDS +unset COLORED_STDERR_FORCE_WRITE +# Set default COLORED_STDERR_PRIVATE_FDS value. fds=2, @@ -78,9 +81,9 @@ run_test() { ( # Standard setup. LD_PRELOAD="$library" - COLORED_STDERR_FDS="$fds" + COLORED_STDERR_PRIVATE_FDS="$fds" export LD_PRELOAD - export COLORED_STDERR_FDS + export COLORED_STDERR_PRIVATE_FDS # Change pre/post strings for simpler testing. COLORED_STDERR_PRE='>STDERR>' @@ -88,7 +91,7 @@ run_test() { export COLORED_STDERR_PRE export COLORED_STDERR_POST # And force writes to a file (unless we are testing the force). - if test "x$force_write" != x; then + if test -n "$force_write"; then COLORED_STDERR_FORCE_WRITE=1 export COLORED_STDERR_FORCE_WRITE fi @@ -105,7 +108,9 @@ run_test() { test_script() { testcase="$1" expected="$2" - shift; shift || true + # shift || true is not enough for dash. + test $# -ge 2 && shift + shift if test -z "$expected"; then expected="$testcase" @@ -118,7 +123,8 @@ test_script_subshell() { test_program() { testcase="$1" expected="$2" - shift; shift || true + test $# -ge 2 && shift + shift if test -z "$expected"; then expected="$testcase"