urchin/tests/Single-file test suites/setup_dir
2016-02-28 18:54:18 +00:00

25 lines
580 B
Plaintext

n=0
tmp=$(mktemp -d)
testdir=$tmp/tests
while read line; do
n=$(($n + 1))
contents=$(echo "$line" | cut -d, -f1)
expectation=$(echo "$line" | cut -d, -f2)
# Set up the test suite.
mkdir -p "$testdir/$n"
touch "$testdir/$n/.urchin"
echo "$contents" > "$testdir/$n/testcase"
# Write the test that runs on the test suite
echo "#!/bin/sh
../../urchin -t '$testdir/$n' | grep '$expectation'" > $n
# Skip if invalid.
if test "$expectation" = ok || test "$expectation" = not\ ok ||
test "$expectation" = skip; then
chmod +x $n
fi
done < .fixtures.csv