@@ -41,7 +41,8 @@ fail() {
41
41
local stderr=${3:- }
42
42
43
43
# shellcheck disable=2154
44
- notify_test_failed " $__bash_unit_current_test__ " " $message "
44
+ notify_test_failed " $__bash_unit_current_test__ "
45
+ notify_message " $message "
45
46
[[ -n " $stdout " ]] && [ -s " $stdout " ] && notify_stdout < " $stdout "
46
47
[[ -n " $stderr " ]] && [ -s " $stderr " ] && notify_stderr < " $stderr "
47
48
@@ -372,12 +373,15 @@ text_format() {
372
373
echo
373
374
}
374
375
notify_test_failed () {
375
- local message=" $2 "
376
376
echo -n " FAILURE" | pretty_failure
377
377
echo
378
+ }
379
+ notify_message () {
380
+ local message=" $1 "
378
381
# shellcheck disable=SC2059
379
382
[[ -z " $message " ]] || printf -- " $message \n"
380
383
}
384
+
381
385
notify_stdout () {
382
386
" $SED " ' s:^:out> :' | color " $GREEN "
383
387
}
@@ -424,9 +428,11 @@ tap_format() {
424
428
}
425
429
notify_test_failed () {
426
430
local test=" $1 "
427
- local message=" $2 "
428
431
echo -n " not ok" | pretty_failure -
429
432
echo " $test " | color " $BLUE "
433
+ }
434
+ notify_message () {
435
+ local message=" $1 "
430
436
[[ -z " $message " ]] || printf -- " %b\n" " $message " | " $SED " -u -e ' s/^/# /'
431
437
}
432
438
notify_stdout () {
@@ -446,6 +452,21 @@ tap_format() {
446
452
}
447
453
}
448
454
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
+
449
470
skip_if () {
450
471
local condition=" $1 "
451
472
local pattern=" $2 "
@@ -457,12 +478,13 @@ skip_if() {
457
478
}
458
479
459
480
output_format=text
481
+ verbosity=normal
460
482
test_pattern=" "
461
483
test_pattern_separator=" "
462
484
skip_pattern=" "
463
485
skip_pattern_separator=" "
464
486
randomize=0
465
- while getopts " vp:s:f:r " option
487
+ while getopts " vp:s:f:rq " option
466
488
do
467
489
case " $option " in
468
490
p)
483
505
echo " bash_unit $VERSION "
484
506
exit
485
507
;;
508
+ q)
509
+ verbosity=quiet
510
+ ;;
486
511
? )
487
512
usage
488
513
;;
@@ -508,6 +533,11 @@ case "$output_format" in
508
533
;;
509
534
esac
510
535
536
+ if [[ " $verbosity " == quiet ]]
537
+ then
538
+ quiet_mode
539
+ fi
540
+
511
541
# run tests received as parameters
512
542
failure=0
513
543
for test_file in " $@ "
0 commit comments