start on more verbosity levels

This commit is contained in:
Thomas Levine 2016-03-06 10:39:40 +00:00
parent fbe825e4b3
commit d39555bfc3

28
urchin
View File

@ -318,14 +318,18 @@ report_outcome() {
fi fi
echo "# Previous test took ${file_elapsed} seconds." echo "# Previous test took ${file_elapsed} seconds."
else else
header() {
if test "${prevdir}" != "${currentdir}"; then if test "${prevdir}" != "${currentdir}"; then
echo echo
fi fi
if test "${prevpath}" != "${path}"; then if test "${prevpath}" != "${path}"; then
printf "$(dirname -- "${path}")/\n> $(basename -- "${path}")\n" printf "$(dirname -- "${path}")/\n> $(basename -- "${path}")\n"
fi fi
}
case "${result}" in case "${result}" in
ok) ok)
if "${print_ok}"; then
header
# On success, print a green '✓' # On success, print a green '✓'
if "${print_in_color}"; then if "${print_in_color}"; then
printf '\033[32m✓ \033[0m' printf '\033[32m✓ \033[0m'
@ -333,8 +337,11 @@ report_outcome() {
printf '✓ ' printf '✓ '
fi fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))" echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
fi
;; ;;
not_ok) not_ok)
if "${print_not_ok}"; then
header
# On not_ok, print a red '✗' # On not_ok, print a red '✗'
if "${print_in_color}"; then if "${print_in_color}"; then
printf '\033[31m✗ \033[0m' printf '\033[31m✗ \033[0m'
@ -342,13 +349,17 @@ report_outcome() {
printf '✗ ' printf '✗ '
fi fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))" echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
fi
;; ;;
skip) skip)
if "${print_ok}"; then
header
if test -z "${the_shell}"; then if test -z "${the_shell}"; then
echo ' (File is not executable.)' echo ' (File is not executable.)'
else else
echo " ${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))" echo " ${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
fi fi
fi
;; ;;
esac esac
if { test "${result}" = not_ok && "${print_not_ok_stdout}"; } || if { test "${result}" = not_ok && "${print_not_ok_stdout}"; } ||
@ -427,15 +438,21 @@ The following flags affect how Urchin processes tests.
-f, --force Force running even if the test directory's name -f, --force Force running even if the test directory's name
does not contain the word "test". does not contain the word "test".
These options affect how results are formatted. These options affect how results are formatted. Options -q, and -v
have no effect when combined with --tap. -vv, -vvv, and -vvvv do have
effect when combined with --tap.
-c, --color Print results in color. -c, --color Print results in color.
-t, --tap Format output in Test Anything Protocol (TAP) -t, --tap Format output in Test Anything Protocol (TAP)
-v, --verbose Print stdout from failing tests.
-vv Print stdout from all tests.
-vvv Print debugging messages (XXX not implemented)
-q, --quiet Print nothing to stdout; the only output is the -q, --quiet Print nothing to stdout; the only output is the
exit code (XXX not implemented). exit code (XXX not implemented).
(default verbosity) Print names of failed tests and counts of passed,
failed, and skipped tests.
-v Print names of passed tests.
-vv, --verbose Print stdout from failing tests.
-vvv Print stdout from all tests.
-vvvv, --debug Print debugging messages (XXX not implemented)
The remaining flags provide information about urchin. The remaining flags provide information about urchin.
@ -475,6 +492,9 @@ main() {
exit_on_not_ok=false exit_on_not_ok=false
tap_format=false tap_format=false
print_in_color=false print_in_color=false
print_ok=false
print_not_ok=true
print_ok_stdout=false print_ok_stdout=false
print_not_ok_stdout=false print_not_ok_stdout=false
while [ "${#}" -gt 0 ] while [ "${#}" -gt 0 ]