docs
This commit is contained in:
parent
248e118f0b
commit
82f17b7172
10
readme.md
10
readme.md
@ -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
20
urchin
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user