urchin/tests/Single-file test suites/.test_testsuite
2016-02-28 22:03:11 +00:00

30 lines
587 B
Bash
Executable File

#!/bin/sh
set -e
export tmp=$(mktemp -d)
contents="$1"
expectation="$2"
testdir=$tmp/tests
mkdir -p $testdir
touch $testdir/.urchin
testcase=$testdir/testcase
# Set up the test suite.
echo "$contents" > $testcase
chmod +x $testcase
case "$expectation" in ok) regex='^ok 1 - testcase';;
not\ ok) regex='^not ok 1 - testcase';;
skip) regex='^ok 1 - testcase ([^)]*) # SKIP';;
*) exit 3;; # skip malformed test
esac
# Run the test suite
set +e
../../urchin -n -t $testdir | grep "$regex"
code=$?
rm -R $tmp
exit $?