45 lines
936 B
Bash
Executable File
45 lines
936 B
Bash
Executable File
#!/bin/bash
|
|
|
|
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
|
|
#stdout_file=$(mktemp)
|
|
stdout_file=/tmp/urchin_stdout
|
|
./"$potential_test" > $stdout_file
|
|
if [ "$?" = '0' ]
|
|
then
|
|
# Print a '✓'
|
|
echo -ne '\033[32m✓ \033[0m'
|
|
echo "${potential_test}"
|
|
else
|
|
# Print a red '✗'
|
|
echo -ne '\033[31m✗ \033[0m'
|
|
echo "${potential_test}"
|
|
cat $stdout_file
|
|
fi
|
|
rm $stdout_file
|
|
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
|