diff --git a/readme.md b/readme.md index 3266e46..42adbac 100644 --- a/readme.md +++ b/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. diff --git a/urchin b/urchin index a51a805..33bad6f 100755 --- a/urchin +++ b/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