11#! /bin/bash
2+ # shellcheck disable=SC2155
23set -euo pipefail
34
45function set_up_before_script() {
@@ -7,25 +8,10 @@ function set_up_before_script() {
78
89function test_bashunit_when_a_execution_error() {
910 local test_file=./tests/acceptance/fixtures/test_bashunit_when_a_execution_error.sh
10- local fixture_start fixture_end
11- local color_default color_red color_dim color_bold
12-
13- color_default=" $( sgr 0) "
14- color_bold=" $( sgr 1) "
15- color_dim=" $( sgr 2) "
16- color_red=" $( sgr 31) "
17-
18- function format_fail_title() {
19- printf " \n%s%s%s%s" " ${color_red} " " $1 " " ${color_default} " " $2 "
20- }
21-
22- function format_expect_title() {
23- printf " \n %s%s%s" " ${color_dim} " " $1 " " ${color_default} "
24- }
25-
26- function format_expect_value() {
27- printf " %s%s%s" " ${color_bold} " " $1 " " ${color_default} "
28- }
11+ local color_default=" $( sgr 0) "
12+ local color_bold=" $( sgr 1) "
13+ local color_dim=" $( sgr 2) "
14+ local color_red=" $( sgr 31) "
2915
3016 function format_summary_title() {
3117 printf " \n%s%s%s" " ${color_dim} " " $1 " " ${color_default} "
@@ -35,26 +21,23 @@ function test_bashunit_when_a_execution_error() {
3521 printf " %s%s%s%s" " ${color_red} " " $1 " " ${color_default} " " $2 "
3622 }
3723
38- fixture_start=$(
39- printf " ${color_bold} %s${color_default} \n" " Running ./tests/acceptance/fixtures/test_bashunit_when_a_execution_error.sh"
40- format_fail_title " ✗ Failed" " : Error"
41- format_expect_title " Expected"
42- format_expect_value " '127'"
43- format_expect_title " to be exactly"
44- format_expect_value " '1'"
24+ local fixture_start=$(
25+ printf " %sRunning ./tests/acceptance/fixtures/test_bashunit_when_a_execution_error.sh%s\n" \
26+ " ${color_bold} " " ${color_default} "
27+ printf " %s✗ Error%s: Error\n" " ${color_red} " " ${color_default} "
28+ printf " %sline 4: invalid_function_name: command not found%s\n" " ${color_dim} " " ${color_default} "
4529 )
46- fixture_end=$(
30+ local fixture_end=$(
4731 format_summary_title " Tests: "
4832 format_summary_value " 1 failed" " , 1 total"
4933 format_summary_title " Assertions:"
50- format_summary_value " 1 failed" " , 1 total"
34+ format_summary_value " 0 failed" " , 0 total"
5135 )
5236
53- todo " Add snapshots with regex to assert this test (part of the error message is localized)"
54- todo " Add snapshots with simple/verbose modes as in bashunit_pass_test and bashunit_fail_test"
37+ # todo "Add snapshots with regex to assert this test (part of the error message is localized)"
38+ # todo "Add snapshots with simple/verbose modes as in bashunit_pass_test and bashunit_fail_test"
5539
56- # shellcheck disable=SC2155
57- local actual=" $( ./bashunit --no-parallel --env " $TEST_ENV_FILE " " $test_file " ) "
40+ local actual=" $( ./bashunit --no-parallel --detailed --env " $TEST_ENV_FILE " " $test_file " ) "
5841 assert_contains " $fixture_start " " $actual "
5942 assert_contains " $fixture_end " " $actual "
6043 assert_general_error " $( ./bashunit --no-parallel --env " $TEST_ENV_FILE " " $test_file " ) "
0 commit comments