File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -324,12 +324,15 @@ function assert_line_count() {
324324 if [ -z " $actual " ]; then
325325 local actual_line_count=0
326326 else
327- local actual_line_count=$( echo " $actual " | wc -l | tr -d ' [:blank:]' )
327+ local actual_line_count
328+ actual_line_count=$( echo " $actual " | wc -l | tr -d ' [:blank:]' )
328329 fi
329330
330331 if [[ " $expected " != " $actual_line_count " ]]; then
331332 state::add_assertions_failed
332- console_results::print_failed_test " ${label} " " ${actual} " " to contain number of lines equal to" " ${expected} "
333+ console_results::print_failed_test " ${label} " " ${actual} " \
334+ " to contain number of lines equal to" " ${expected} " \
335+ " but found" " ${actual_line_count} "
333336 return
334337 fi
335338
Original file line number Diff line number Diff line change @@ -146,12 +146,20 @@ function console_results::print_failed_test() {
146146 local expected=$2
147147 local failure_condition_message=$3
148148 local actual=$4
149+ local extra_key=$5
150+ local extra_value=$6
149151
150152 printf " \
151153${_COLOR_FAILED} ✗ Failed${_COLOR_DEFAULT} : %s
152154 ${_COLOR_FAINT} Expected${_COLOR_DEFAULT} ${_COLOR_BOLD} '%s'${_COLOR_DEFAULT}
153155 ${_COLOR_FAINT} %s${_COLOR_DEFAULT} ${_COLOR_BOLD} '%s'${_COLOR_DEFAULT} \n" \
154156 " ${test_name} " " ${expected} " " ${failure_condition_message} " " ${actual} "
157+
158+ if [ -n " $extra_key " ]; then
159+ printf " \
160+ ${_COLOR_FAINT} %s${_COLOR_DEFAULT} ${_COLOR_BOLD} '%s'${_COLOR_DEFAULT} \n" \
161+ " ${extra_key} " " ${extra_value} "
162+ fi
155163}
156164
157165function console_results::print_failed_snapshot_test() {
Original file line number Diff line number Diff line change @@ -348,6 +348,6 @@ function test_successful_assert_line_count() {
348348function test_unsuccessful_assert_line_count() {
349349 assert_equals\
350350 " $( console_results::print_failed_test\
351- " Unsuccessful assert line count" " one_line_string" " to contain number of lines equal to" " 10" ) " \
351+ " Unsuccessful assert line count" " one_line_string" " to contain number of lines equal to" " 10" " but found " " 1 " ) " \
352352 " $( assert_line_count 10 " one_line_string" ) "
353353}
You can’t perform that action at this time.
0 commit comments