start writing non-tap cases
This commit is contained in:
parent
d01e993041
commit
a6d6730e74
11
urchin
11
urchin
@ -70,6 +70,9 @@ recurse() {
|
|||||||
|
|
||||||
[ -f teardown ] && [ -x teardown ] && ./teardown >> "$stdout_file"
|
[ -f teardown ] && [ -x teardown ] && ./teardown >> "$stdout_file"
|
||||||
|
|
||||||
|
if $tap_format; then
|
||||||
|
sleep 0s
|
||||||
|
else
|
||||||
indent $indent_level
|
indent $indent_level
|
||||||
if [ $exit_code -eq 0 ]
|
if [ $exit_code -eq 0 ]
|
||||||
then
|
then
|
||||||
@ -87,6 +90,7 @@ recurse() {
|
|||||||
printf '\033[0m'
|
printf '\033[0m'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
[ $indent_level -eq 0 ] && rm "$stdout_file"
|
[ $indent_level -eq 0 ] && rm "$stdout_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +111,7 @@ $USAGE
|
|||||||
have shebang line "#!/bin/sh" with the specified shell.
|
have shebang line "#!/bin/sh" with the specified shell.
|
||||||
-f Force running even if the test directory's name does not
|
-f Force running even if the test directory's name does not
|
||||||
contain the word "test".
|
contain the word "test".
|
||||||
|
-t Format output in Test Anything Protocol (TAP)
|
||||||
-h This help.
|
-h This help.
|
||||||
|
|
||||||
Go to https://github.com/tlevine/urchin for documentation on writing tests.
|
Go to https://github.com/tlevine/urchin for documentation on writing tests.
|
||||||
@ -147,12 +152,16 @@ urchin_go() {
|
|||||||
|
|
||||||
finish=$(date +%s)
|
finish=$(date +%s)
|
||||||
elapsed=$(($finish - $start))
|
elapsed=$(($finish - $start))
|
||||||
|
if $tap_format; then
|
||||||
|
sleep 0s
|
||||||
|
else
|
||||||
echo "Done, took $elapsed $(plural second $elapsed)."
|
echo "Done, took $elapsed $(plural second $elapsed)."
|
||||||
set -- $(grep -e 'passed$' "$logfile"|wc -l) $(grep -e 'failed$' "$logfile"|wc -l)
|
set -- $(grep -e 'passed$' "$logfile"|wc -l) $(grep -e 'failed$' "$logfile"|wc -l)
|
||||||
printf '%s\n' "$1 $(plural test "$1") passed."
|
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.
|
[ $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 '%s\n' "$2 $(plural test "$2") failed."
|
||||||
printf '\033[m'
|
printf '\033[m'
|
||||||
|
fi
|
||||||
return "$2"
|
return "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,6 +179,7 @@ urchin_molly_guard() {
|
|||||||
|
|
||||||
shell_for_sh_tests=
|
shell_for_sh_tests=
|
||||||
force=false
|
force=false
|
||||||
|
tap_format=false
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -179,6 +189,7 @@ do
|
|||||||
shell_for_sh_tests=$1
|
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; }
|
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
|
-h|--help) urchin_help
|
||||||
exit 0;;
|
exit 0;;
|
||||||
-*) urchin_help >&2
|
-*) urchin_help >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user