aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-09-12 21:54:15 +1200
committerDavid Phillips <david@sighup.nz>2017-09-12 21:54:15 +1200
commitb997bc16ec4a4f61960d9b383021d1a3fd0efd2f (patch)
tree3cad6beb32ec131187aa30a3e8903bdf88b0e27c /test
parent217232de213b6d974da00d8760e3fa4e3c85bb7a (diff)
downloadcue-bin-split-master.tar.xz
Clean up test runner scriptHEADmaster
Diffstat (limited to 'test')
-rwxr-xr-xtest/run-tests.sh24
1 files changed, 11 insertions, 13 deletions
diff --git a/test/run-tests.sh b/test/run-tests.sh
index 13f623e..eeee486 100755
--- a/test/run-tests.sh
+++ b/test/run-tests.sh
@@ -1,41 +1,39 @@
-#!/bin/sh
+#!/bin/bash
fail()
{
- echo -e '[\e[1;31mFAIL\e[0m] '$i: $@
+ echo -e '[\e[1;31mFAIL\e[0m] '"$i:" "$@"
exit 1
}
pass()
{
- echo -e '[\e[0;32mPASS\e[0m] '$i
+ echo -e '[\e[0;32mPASS\e[0m] '"$i"
}
check_expected()
{
- [ -z $1 ] && echo WARN: check_expected called with no argument
- if [ -f $1.expected ] ; then
- diff $1.expected $1.tmp >/dev/null
- if [ $? -ne 0 ] ; then
+ [ -z "$1" ] && echo WARN: check_expected called with no argument
+ if [ -f "$1.expected" ] ; then
+ if ! diff "$1.expected" "$1.tmp" >/dev/null; then
fail "$1 didn't match expected"
fi
fi
}
-pushd $(dirname $0) >/dev/null
-EXECUTABLE="$PWD/../cue-bin-split"
+pushd "$(dirname "$0")" >/dev/null
+export EXECUTABLE="$PWD/../cue-bin-split"
for i in *.test ; do
- pushd ${i} >/dev/null
- ( . ./run.sh ) 2>stderr.tmp >stdout.tmp
- if [ $? -ne 0 ] ; then
+ pushd "${i}" >/dev/null
+ if ! ( . ./run.sh ) 2>stderr.tmp >stdout.tmp; then
fail "script had non-zero return code"
fi
check_expected stdout
check_expected stderr
- pass $i
+ pass "$i"
rm std{err,out}.tmp
popd >/dev/null