@@ -251,9 +251,9 @@ assert_line() {
251251 if (( is_mode_regexp )) ; then
252252 if ! [[ ${lines[$idx]} =~ $expected ]]; then
253253 batslib_print_kv_single 6 \
254- ' index' " $idx " \
254+ ' index' " $idx " \
255255 ' regexp' " $expected " \
256- ' line' " ${lines[$idx]} " \
256+ ' line' " ${lines[$idx]} " \
257257 | batslib_decorate ' regular expression does not match line' \
258258 | fail
259259 fi
@@ -373,7 +373,7 @@ assert_output() {
373373 elif ! [[ $output =~ $expected ]]; then
374374 batslib_print_kv_single_or_multi 6 \
375375 ' regexp' " $expected " \
376- ' output' " $output " \
376+ ' output' " $output " \
377377 | batslib_decorate ' regular expression does not match output' \
378378 | fail
379379 fi
@@ -468,9 +468,9 @@ refute_line() {
468468 if (( is_mode_regexp )) ; then
469469 if [[ ${lines[$idx]} =~ $unexpected ]]; then
470470 batslib_print_kv_single 6 \
471- ' index' " $idx " \
471+ ' index' " $idx " \
472472 ' regexp' " $unexpected " \
473- ' line' " ${lines[$idx]} " \
473+ ' line' " ${lines[$idx]} " \
474474 | batslib_decorate ' regular expression should not match line' \
475475 | fail
476476 fi
@@ -613,7 +613,7 @@ refute_output() {
613613 elif (( is_mode_regexp )) ; then
614614 if [[ $output =~ $unexpected ]]; then
615615 batslib_print_kv_single_or_multi 6 \
616- ' regexp' " $unexpected " \
616+ ' regexp' " $unexpected " \
617617 ' output' " $output " \
618618 | batslib_decorate ' regular expression should not match output' \
619619 | fail
@@ -635,3 +635,19 @@ refute_output() {
635635 fi
636636 fi
637637}
638+
639+ assert_between () {
640+ local -r start=" ${1} "
641+ local -r end=" ${2} "
642+
643+ if (( start > end )) ; then
644+ return 1
645+ elif ! (( output >= "$1 " && output <= "$2 " )) ; then
646+ batslib_print_kv_single_or_multi 6 \
647+ ' start' " ${start} " \
648+ ' end' " ${end} " \
649+ ' actual' " ${output} " \
650+ | batslib_decorate ' output falls outside the inclusive range defined by start and end' \
651+ | fail
652+ fi
653+ }
0 commit comments