start writing non-tap cases

This commit is contained in:
Thomas Levine 2016-01-27 00:32:51 +00:00
parent d01e993041
commit a6d6730e74

11
urchin
View File

@ -70,6 +70,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
@ -87,6 +90,7 @@ recurse() {
printf '\033[0m'
fi
fi
fi
[ $indent_level -eq 0 ] && rm "$stdout_file"
}
@ -107,6 +111,7 @@ $USAGE
have shebang line "#!/bin/sh" with the specified shell.
-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.
@ -147,12 +152,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"
}
@ -170,6 +179,7 @@ urchin_molly_guard() {
shell_for_sh_tests=
force=false
tap_format=false
while [ $# -gt 0 ]
do
case "$1" in
@ -179,6 +189,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