File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ Running tests in tests/test_core.sh
108108 Running test_fake_echo_stdin_when_no_params ... SUCCESS
109109 Running test_fake_exports_faked_in_subshells ... SUCCESS
110110 Running test_fake_transmits_params_to_fake_code ... SUCCESS
111+ Running test_should_pretty_format_even_when_LANG_is_unset ... SUCCESS
111112Overall result: SUCCESS
112113```
113114
@@ -166,6 +167,7 @@ ok - test_fake_can_fake_inline
166167ok - test_fake_echo_stdin_when_no_params
167168ok - test_fake_exports_faked_in_subshells
168169ok - test_fake_transmits_params_to_fake_code
170+ ok - test_should_pretty_format_even_when_LANG_is_unset
169171```
170172
171173== How to write tests
Original file line number Diff line number Diff line change @@ -233,9 +233,10 @@ pretty_failure() {
233233pretty_format () {
234234 local color=" $1 "
235235 local pretty_symbol=" $2 "
236- local alt_symbol=" $3 "
236+ local alt_symbol=" ${3 :- } "
237237 local term_utf8=false
238- if is_terminal && [[ " $LANG " =~ .* UTF-8.* ]]
238+ # env
239+ if is_terminal && [[ " ${LANG:- } " =~ .* UTF-8.* ]]
239240 then
240241 term_utf8=true
241242 fi
@@ -270,7 +271,7 @@ color() {
270271}
271272
272273is_terminal () {
273- [ -t 1 ] || [[ " ${FORCE_COLOR} " == true ]]
274+ [ -t 1 ] || [[ " ${FORCE_COLOR:- } " == true ]]
274275}
275276
276277text_format () {
Original file line number Diff line number Diff line change 138138 assert_equals 2 $( ps | " $GREP " pts | wc -l)
139139}
140140
141+ test_should_pretty_format_even_when_LANG_is_unset () {
142+ # See https://github.com/pgrange/bash_unit/pull/81
143+ unset LANG
144+ assert " echo foo | pretty_format GREEN I"
145+ }
146+
141147if [[ " ${STICK_TO_CWD} " != true ]]
142148then
143149 # do not test for cwd if STICK_TO_CWD is true
You can’t perform that action at this time.
0 commit comments