start writing non-tap cases

This commit is contained in:
Thomas Levine 2016-01-27 00:32:51 +00:00
parent c817355e94
commit 92cb735bb7

11
urchin
View File

@ -76,6 +76,9 @@ recurse() {
[ -f teardown ] && [ -x teardown ] && ./teardown >> "$stdout_file"
if $tap_format; then
sleep 0s
else
indent $indent_level
if [ $exit_code -eq 0 ]
then
@ -92,6 +95,7 @@ recurse() {
cat "$stdout_file"
printf '\033[0m'
fi
fi
if $exit_on_fail && test 0 -ne $exit_code; then
return 1
@ -120,6 +124,7 @@ $USAGE
configuration scripts.
-f Force running even if the test directory's name does not
contain the word "test".
-t Format output in Test Anything Protocol (TAP)
-h This help.
Go to https://github.com/tlevine/urchin for documentation on writing tests.
@ -160,12 +165,16 @@ urchin_go() {
finish=$(date +%s)
elapsed=$(($finish - $start))
if $tap_format; then
sleep 0s
else
echo "Done, took $elapsed $(plural second $elapsed)."
set -- $(grep -e 'passed$' "$logfile"|wc -l) $(grep -e 'failed$' "$logfile"|wc -l)
printf '%s\n' "$1 $(plural test "$1") passed."
[ $2 -gt 0 ] && printf '\033[31m' || printf '\033[32m' # If tests failed, print the message in red, otherwise in green.
printf '%s\n' "$2 $(plural test "$2") failed."
printf '\033[m'
fi
return "$2"
}
@ -184,6 +193,7 @@ urchin_molly_guard() {
shell_for_sh_tests=
force=false
exit_on_fail=false
tap_format=false
while [ $# -gt 0 ]
do
case "$1" in
@ -194,6 +204,7 @@ do
shell_for_sh_tests=$1
which "$shell_for_sh_tests" >/dev/null || { echo "Cannot find specified shell: '$shell_for_sh_tests'" >&2; urchin_help >&2; exit 2; }
;;
-t) tap_format=true;;
-h|--help) urchin_help
exit 0;;
-*) urchin_help >&2