diff options
author | David Phillips <dbphillipsnz@gmail.com> | 2016-03-12 23:31:02 +1300 |
---|---|---|
committer | David Phillips <dbphillipsnz@gmail.com> | 2016-03-12 23:32:13 +1300 |
commit | 4ad1f662ff407644e33be1101b4b17df01c64fd0 (patch) | |
tree | e41ad272a7752ece3215b12289945d82ee55fec0 /test/run-tests.sh | |
parent | e7211deebd7348ff34265cca8be7d5f5c9a9dcb1 (diff) | |
download | cue-bin-split-4ad1f662ff407644e33be1101b4b17df01c64fd0.tar.xz |
Added quick test framework
Diffstat (limited to 'test/run-tests.sh')
-rwxr-xr-x | test/run-tests.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/run-tests.sh b/test/run-tests.sh new file mode 100755 index 0000000..3b82bc2 --- /dev/null +++ b/test/run-tests.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +err_file="stderr.tmp" +out_file="stdout.tmp" +EXECUTABLE="$PWD/../cue-bin-split" + +fail() +{ + echo "[FAIL] $i: $@" + exit 1 +} + +for i in *.test ; do + pushd ${i} >/dev/null + ( . ./run.sh ) 2>${err_file} >${out_file} + if [ $? -ne 0 ] ; then + fail "script had non-zero return code" + fi + + if [ -f stderr.expected ] ; then + diff stderr.expected stderr.tmp + if [ $? -ne 0 ] ; then + fail "stderr didn't match expected" + fi + fi + + if [ -f stdout.expected ] ; then + diff stdout.expected stdout.tmp + if [ $? -ne 0 ] ; then + fail "stdout didn't match expected" + fi + fi + + echo "[PASS] $i" + + rm ${err_file} ${out_file} + popd >/dev/null +done |