This commit is contained in:
Thomas Levine 2012-10-10 15:47:21 -04:00
parent 693e6cd438
commit 1bd7b4adf6
2 changed files with 10 additions and 7 deletions

View File

@ -30,6 +30,7 @@ and directories have special meanings.
tests/
setup
setup_dir
bar/
setup
test_that_something_works
@ -46,11 +47,11 @@ and directories have special meanings.
teardown
Directories are processed in a depth-first order. When a particular directory
is processed, `setup` is sourced before everything else in the directory, including
subdirectories. Export variables from the setup function to make them available
to other files in the same directory.
is processed, `setup_dir` is run before everything else in the directory, including
subdirectories. `teardown_dir` is run after everything else in the directory.
`teardown` is run after everything else in the directory.
A directory's `setup` file, if it exists, is run right before each test file
within the particular directory, and the `teardown` file is run right after.
Files are only run if they are executable, and files beginning with `.` are
ignored. Thus, fixtures and libraries can be included sloppily within the test

8
urchin
View File

@ -12,7 +12,7 @@ recurse() {
then
(
cd "$potential_test"
[ -f setup_dir ] && . ./setup_dir
[ -f setup_dir ] && [ -x setup_dir ] && . ./setup_dir
for test in *
do recurse "${test}"
done
@ -23,10 +23,12 @@ recurse() {
#stdout_file=$(mktemp)
stdout_file=/tmp/urchin_stdout
[ -f setup ] && [ -x setup ] && . ./setup &>> $stdout_file
# Run the test
[ -f setup ] && . ./setup &>> $stdout_file
./"$potential_test" &>> $stdout_file
exit_code="$?"
[ -f teardown ] && [ -x teardown ] && ./teardown &>> $stdout_file
if [ "$exit_code" = '0' ]
@ -38,7 +40,7 @@ recurse() {
# On fail, print a red '✗'
echo -ne '\033[31m✗ \033[0m'
echo "${potential_test}"
cat $stdout_file
# cat $stdout_file
fi
rm $stdout_file
fi