@@ -279,7 +279,7 @@ assert_output_matches() {
279279 local pattern=" $1 "
280280
281281 if [[ " $# " -ne 1 ]]; then
282- echo " ERROR: ${FUNCNAME[0]} takes exactly one argument" >&2
282+ printf ' ERROR: %s takes exactly one argument\n ' " ${FUNCNAME[0]} " >&2
283283 return_from_bats_assertion ' 1'
284284 else
285285 assert_matches " $pattern " " $output " ' output'
@@ -568,20 +568,21 @@ __assert_lines() {
568568
569569 if [[ " $lines_diff " -gt ' 0' ]]; then
570570 if [[ " $lines_diff " -eq ' 1' ]]; then
571- echo " There is one more line of output than expected:" >&2
571+ printf ' There is one more line of output than expected:\n ' >&2
572572 else
573- echo " There are $lines_diff more lines of output than expected:" >&2
573+ printf ' There are %d more lines of output than expected:\n' \
574+ " $lines_diff " >&2
574575 fi
575- local IFS=$' \n '
576- echo " ${lines[*]: $num_lines } " >&2
576+ printf ' %s\n' " ${lines[@]: $num_lines } " >&2
577577 (( ++ num_errors))
578578
579579 elif [[ " $lines_diff " -lt ' 0' ]]; then
580580 lines_diff=" $(( - lines_diff)) "
581581 if [[ " $lines_diff " -eq ' 1' ]]; then
582- echo " There is one fewer line of output than expected." >&2
582+ printf ' There is one fewer line of output than expected.\n ' >&2
583583 else
584- echo " There are $lines_diff fewer lines of output than expected." >&2
584+ printf ' There are %d fewer lines of output than expected.\n' \
585+ " $lines_diff " >&2
585586 fi
586587 (( ++ num_errors))
587588 fi
@@ -610,7 +611,7 @@ __assert_file() {
610611
611612 if [[ " $assertion " == ' assert_matches' ]]; then
612613 if [[ " $# " -ne ' 1' ]]; then
613- echo " ERROR: ${FUNCNAME[1]} takes exactly two arguments" >&2
614+ printf ' ERROR: %s takes exactly two arguments\n ' " ${FUNCNAME[1]} " >&2
614615 return ' 1'
615616 fi
616617 constraints=(" $1 " " $output " " The content of '$file_path '" )
0 commit comments