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
|
## Writing tests
|
||||||
Make a root directory for your tests. Inside it, put executable files that
|
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
|
exit `0` on success and something else on fail. Non-executable files and hidden
|
||||||
ignored, so you can store fixtures right next to your tests. Run urchin from
|
files (dotfiles) are ignored, so you can store fixtures right next to your
|
||||||
inside the tests directory.
|
tests. Run urchin from inside the tests directory.
|
||||||
|
|
||||||
## More about writing tests
|
## More about writing tests
|
||||||
Tests are organized recursively in directories, where the names of the files
|
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
|
actually only includes files whose names contain "test". The test passes if the
|
||||||
file exits 0; otherwise, it fails.
|
file exits 0; otherwise, it fails.
|
||||||
|
|
||||||
Aside from files named '`setup`' or '`teardown`', files and directories are run
|
Files are only run if they are executable, and files beginning with `.` are
|
||||||
only if they start with '`test`'. Thus, fixtures and libraries can be included
|
ignored. Thus, fixtures and libraries can be included
|
||||||
sloppily within the test directory tree.
|
sloppily within the test directory tree.
|
||||||
|
|
20
urchin
20
urchin
|
@ -6,11 +6,11 @@ recurse() {
|
||||||
then
|
then
|
||||||
(
|
(
|
||||||
cd "$potential_test"
|
cd "$potential_test"
|
||||||
[ -f setup ] && sh setup
|
[ -f setup ] && [ -x setup ] && ./setup
|
||||||
for test in test*
|
for test in *
|
||||||
do recurse "${test}"
|
do recurse "${test}"
|
||||||
done
|
done
|
||||||
[ -f teardown ] && sh teardown
|
[ -f teardown ] && [ -x teardown ] && ./teardown
|
||||||
)
|
)
|
||||||
elif [ -x "$potential_test" ]
|
elif [ -x "$potential_test" ]
|
||||||
then
|
then
|
||||||
|
@ -28,12 +28,8 @@ recurse() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -d tests ]
|
then
|
||||||
then
|
echo Running tests
|
||||||
echo Running tests
|
recurse tests
|
||||||
recurse tests
|
echo
|
||||||
echo
|
echo Done
|
||||||
echo Done
|
|
||||||
else
|
|
||||||
echo 'No tests directory' && exit 1
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue