@@ -41,7 +41,8 @@ fail() {
4141 local stderr=${3:- }
4242
4343 # shellcheck disable=2154
44- notify_test_failed " $__bash_unit_current_test__ " " $message "
44+ notify_test_failed " $__bash_unit_current_test__ "
45+ notify_message " $message "
4546 [[ -n " $stdout " ]] && [ -s " $stdout " ] && notify_stdout < " $stdout "
4647 [[ -n " $stderr " ]] && [ -s " $stderr " ] && notify_stderr < " $stderr "
4748
@@ -372,12 +373,15 @@ text_format() {
372373 echo
373374 }
374375 notify_test_failed () {
375- local message=" $2 "
376376 echo -n " FAILURE" | pretty_failure
377377 echo
378+ }
379+ notify_message () {
380+ local message=" $1 "
378381 # shellcheck disable=SC2059
379382 [[ -z " $message " ]] || printf -- " $message \n"
380383 }
384+
381385 notify_stdout () {
382386 " $SED " ' s:^:out> :' | color " $GREEN "
383387 }
@@ -424,9 +428,11 @@ tap_format() {
424428 }
425429 notify_test_failed () {
426430 local test=" $1 "
427- local message=" $2 "
428431 echo -n " not ok" | pretty_failure -
429432 echo " $test " | color " $BLUE "
433+ }
434+ notify_message () {
435+ local message=" $1 "
430436 [[ -z " $message " ]] || printf -- " %b\n" " $message " | " $SED " -u -e ' s/^/# /'
431437 }
432438 notify_stdout () {
@@ -446,6 +452,21 @@ tap_format() {
446452 }
447453}
448454
455+ quiet_mode () {
456+ notify_message () {
457+ :
458+ }
459+ notify_stdout () {
460+ :
461+ }
462+ notify_stderr () {
463+ :
464+ }
465+ notify_stack () {
466+ :
467+ }
468+ }
469+
449470skip_if () {
450471 local condition=" $1 "
451472 local pattern=" $2 "
@@ -457,12 +478,13 @@ skip_if() {
457478}
458479
459480output_format=text
481+ verbosity=normal
460482test_pattern=" "
461483test_pattern_separator=" "
462484skip_pattern=" "
463485skip_pattern_separator=" "
464486randomize=0
465- while getopts " vp:s:f:r " option
487+ while getopts " vp:s:f:rq " option
466488do
467489 case " $option " in
468490 p)
483505 echo " bash_unit $VERSION "
484506 exit
485507 ;;
508+ q)
509+ verbosity=quiet
510+ ;;
486511 ? )
487512 usage
488513 ;;
@@ -508,6 +533,11 @@ case "$output_format" in
508533 ;;
509534esac
510535
536+ if [[ " $verbosity " == quiet ]]
537+ then
538+ quiet_mode
539+ fi
540+
511541# run tests received as parameters
512542failure=0
513543for test_file in " $@ "
0 commit comments