2016-02-28 14:18:54 -05:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2016-02-28 17:03:11 -05:00
|
|
|
export tmp=$(mktemp -d)
|
|
|
|
|
2016-02-28 14:26:18 -05:00
|
|
|
contents="$1"
|
|
|
|
expectation="$2"
|
|
|
|
|
2016-02-28 14:18:54 -05:00
|
|
|
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';;
|
2016-02-28 14:34:47 -05:00
|
|
|
skip) regex='^ok 1 - testcase ([^)]*) # SKIP';;
|
2016-02-28 14:26:18 -05:00
|
|
|
*) exit 3;; # skip malformed test
|
2016-02-28 14:18:54 -05:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Run the test suite
|
2016-02-28 17:03:11 -05:00
|
|
|
set +e
|
2016-02-28 14:18:54 -05:00
|
|
|
../../urchin -n -t $testdir | grep "$regex"
|
2016-02-28 17:03:11 -05:00
|
|
|
code=$?
|
|
|
|
rm -R $tmp
|
|
|
|
exit $?
|