diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | test/001-basic.test/run.sh | 8 | ||||
-rw-r--r-- | test/001-basic.test/stderr.expected | 8 | ||||
-rwxr-xr-x | test/run-tests.sh | 38 |
4 files changed, 54 insertions, 1 deletions
@@ -3,5 +3,4 @@ cue-bin-split track_* *.bin *.cue -*.sh *.raw diff --git a/test/001-basic.test/run.sh b/test/001-basic.test/run.sh new file mode 100755 index 0000000..4e67e1d --- /dev/null +++ b/test/001-basic.test/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +${EXECUTABLE} +if [ $? -eq 0 ]; then + exit 1 +else + exit 0 +fi diff --git a/test/001-basic.test/stderr.expected b/test/001-basic.test/stderr.expected new file mode 100644 index 0000000..bdf19af --- /dev/null +++ b/test/001-basic.test/stderr.expected @@ -0,0 +1,8 @@ +ERROR: Channel count, bitrate and sample size must all be present and positive + +Options: + -r bitrate_Hz + -c channel_count + -i input_file + -s size of a single channel's sample (bytes) + -f name_format (%d and co are replaced with track number) 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 |