start on more verbosity levels

This commit is contained in:
Thomas Levine 2016-03-06 10:39:40 +00:00
parent fbe825e4b3
commit d39555bfc3
1 changed files with 46 additions and 26 deletions

72
urchin
View File

@ -318,36 +318,47 @@ report_outcome() {
fi fi
echo "# Previous test took ${file_elapsed} seconds." echo "# Previous test took ${file_elapsed} seconds."
else else
if test "${prevdir}" != "${currentdir}"; then header() {
echo if test "${prevdir}" != "${currentdir}"; then
fi echo
if test "${prevpath}" != "${path}"; then fi
printf "$(dirname -- "${path}")/\n> $(basename -- "${path}")\n" if test "${prevpath}" != "${path}"; then
fi printf "$(dirname -- "${path}")/\n> $(basename -- "${path}")\n"
fi
}
case "${result}" in case "${result}" in
ok) ok)
# On success, print a green '✓' if "${print_ok}"; then
if "${print_in_color}"; then header
printf '\033[32m✓ \033[0m' # On success, print a green '✓'
else if "${print_in_color}"; then
printf '✓ ' printf '\033[32m✓ \033[0m'
else
printf '✓ '
fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
fi fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
;; ;;
not_ok) not_ok)
# On not_ok, print a red '✗' if "${print_not_ok}"; then
if "${print_in_color}"; then header
printf '\033[31m✗ \033[0m' # On not_ok, print a red '✗'
else if "${print_in_color}"; then
printf '✗ ' printf '\033[31m✗ \033[0m'
else
printf '✗ '
fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
fi fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
;; ;;
skip) skip)
if test -z "${the_shell}"; then if "${print_ok}"; then
echo ' (File is not executable.)' header
else if test -z "${the_shell}"; then
echo " ${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))" echo ' (File is not executable.)'
else
echo " ${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
fi
fi fi
;; ;;
esac esac
@ -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 ]