diff --git a/tests/Exit codes/.test/.urchin b/tests/Errors/.test/.urchin similarity index 100% rename from tests/Exit codes/.test/.urchin rename to tests/Errors/.test/.urchin diff --git a/tests/Exit codes/.test/This test fails b/tests/Errors/.test/This test fails similarity index 100% rename from tests/Exit codes/.test/This test fails rename to tests/Errors/.test/This test fails diff --git a/tests/Exit codes/.test/This test passes b/tests/Errors/.test/This test passes similarity index 100% rename from tests/Exit codes/.test/This test passes rename to tests/Errors/.test/This test passes diff --git a/tests/Exit codes/.test/This test skips b/tests/Errors/.test/This test skips similarity index 100% rename from tests/Exit codes/.test/This test skips rename to tests/Errors/.test/This test skips diff --git a/tests/Exit codes/0 when all tests pass b/tests/Errors/0 when all tests pass similarity index 100% rename from tests/Exit codes/0 when all tests pass rename to tests/Errors/0 when all tests pass diff --git a/tests/Exit codes/0 when all tests skip b/tests/Errors/0 when all tests skip similarity index 100% rename from tests/Exit codes/0 when all tests skip rename to tests/Errors/0 when all tests skip diff --git a/tests/Exit codes/1 when any test fails b/tests/Errors/1 when any test fails similarity index 100% rename from tests/Exit codes/1 when any test fails rename to tests/Errors/1 when any test fails diff --git a/tests/Errors/1 when no tests are found/exit code b/tests/Errors/1 when no tests are found/exit code new file mode 100755 index 0000000..ad5fba4 --- /dev/null +++ b/tests/Errors/1 when no tests are found/exit code @@ -0,0 +1,3 @@ +#!/bin/sh +../../../urchin $testdir +test 1 -eq $? diff --git a/tests/Errors/1 when no tests are found/setup b/tests/Errors/1 when no tests are found/setup new file mode 100644 index 0000000..f55b858 --- /dev/null +++ b/tests/Errors/1 when no tests are found/setup @@ -0,0 +1,4 @@ +tmp=$(mktemp -d) +export testdir=$tmp/tests +mkdir -p $testdir +touch $testdir/.urchin diff --git a/tests/Errors/1 when no tests are found/stderr b/tests/Errors/1 when no tests are found/stderr new file mode 100755 index 0000000..6ceb5ec --- /dev/null +++ b/tests/Errors/1 when no tests are found/stderr @@ -0,0 +1,2 @@ +#!/bin/sh +../../../urchin $testdir 2>&1 | grep -i 'no.*found' diff --git a/tests/Errors/1 when no tests are found/teardown b/tests/Errors/1 when no tests are found/teardown new file mode 100644 index 0000000..1a687aa --- /dev/null +++ b/tests/Errors/1 when no tests are found/teardown @@ -0,0 +1 @@ +rm -R $tmp diff --git a/tests/Exit codes/11 on argument errors b/tests/Errors/11 on argument errors similarity index 100% rename from tests/Exit codes/11 on argument errors rename to tests/Errors/11 on argument errors diff --git a/tests/Single-file test suites/empty testsuite b/tests/Single-file test suites/empty testsuite deleted file mode 100755 index 1942074..0000000 --- a/tests/Single-file test suites/empty testsuite +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -e - -tmp=$(mktemp -d) -testdir=$tmp/tests -mkdir -p $testdir - -set +e -../../urchin -n -t $testdir -e=$? -set -e - -rm -R $tmp -exit $e diff --git a/urchin b/urchin index 16c958c..ca98676 100755 --- a/urchin +++ b/urchin @@ -56,10 +56,6 @@ if [ -n "${ZSH_VERSION}" ]; then fi -# Make sure that CDPATH isn't set, as it causes `cd` to behave unpredictably - -# notably, it can produce output. -unset CDPATH - # All temporary files go here urchin_tmp=$(mktemp -d) > "${urchin_tmp}/log" @@ -146,7 +142,7 @@ recurse() { if [ -d "${potential_test}" ]; then ( - cd -- "${potential_test}" > /dev/null + cd -- "${potential_test}" if test -f setup_dir; then . ./setup_dir; fi for test in *; do @@ -568,6 +564,11 @@ main() { recurse "$(fullpath "${1}")" "${root}" "${cycle_shell}" "${TEST_SHELL}" || : finish=$(date +%s) + test $(cat "${urchin_tmp}"/log | wc -l) -gt 0 || { + echo 'No tests found' > /dev/stderr + urchin_exit 1 + } + report_outcome "${root}" "${tap_format}" "${urchin_tmp}"/log "${start}" \ "${finish}" urchin_exit "${?}"