This commit is contained in:
Thomas Levine 2012-10-08 10:16:49 -04:00
parent 248e118f0b
commit 82f17b7172
2 changed files with 13 additions and 17 deletions

View File

@ -20,9 +20,9 @@ Now you can run it.
## Writing tests
Make a root directory for your tests. Inside it, put executable files that
exit `0` on success and something else on fail. Non-executable files are
ignored, so you can store fixtures right next to your tests. Run urchin from
inside the tests directory.
exit `0` on success and something else on fail. Non-executable files and hidden
files (dotfiles) are ignored, so you can store fixtures right next to your
tests. Run urchin from inside the tests directory.
## More about writing tests
Tests are organized recursively in directories, where the names of the files
@ -55,6 +55,6 @@ directory.
actually only includes files whose names contain "test". The test passes if the
file exits 0; otherwise, it fails.
Aside from files named '`setup`' or '`teardown`', files and directories are run
only if they start with '`test`'. Thus, fixtures and libraries can be included
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 directory tree.

20
urchin
View File

@ -6,11 +6,11 @@ recurse() {
then
(
cd "$potential_test"
[ -f setup ] && sh setup
for test in test*
[ -f setup ] && [ -x setup ] && ./setup
for test in *
do recurse "${test}"
done
[ -f teardown ] && sh teardown
[ -f teardown ] && [ -x teardown ] && ./teardown
)
elif [ -x "$potential_test" ]
then
@ -28,12 +28,8 @@ recurse() {
fi
}
if [ -d tests ]
then
echo Running tests
recurse tests
echo
echo Done
else
echo 'No tests directory' && exit 1
fi
then
echo Running tests
recurse tests
echo
echo Done