urchin/urchin
2012-10-08 10:43:14 -04:00

41 lines
778 B
Bash
Executable File

#!/bin/sh
recurse() {
potential_test="$1"
if [ -d "$potential_test" ]
then
(
cd "$potential_test"
[ -f setup ] && . ./setup
for test in *
do recurse "${test}"
done
[ -f teardown ] && [ -x teardown ] && ./teardown
)
elif [ -x "$potential_test" ]
then
./"$potential_test"
if [ "$?" = '0' ]
then
# Print a '.'
echo -n .
else
# Print a red 'F'
echo -ne '\033[31mF'
echo -n "(${potential_test})"
echo -ne "\033[0m"
fi
fi
}
if [ "$*" = '' ]
then
echo Running tests
recurse .
echo
echo Done
else
echo 'Run `urchin` without arguments from a directory containing urchin tests.'
echo 'Go to http://www.urchin.sh for documentation on writing tests.'
fi