Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Running tests in tests/test_core.sh
Running test_fake_transmits_params_to_fake_code ... SUCCESS
Running test_fake_transmits_params_to_fake_code_as_array ... SUCCESS
Running test_should_pretty_format_even_when_LANG_is_unset ... SUCCESS
Running test_should_pretty_format_even_with_pipefail_set ... SUCCESS
Overall result: SUCCESS
```

Expand Down Expand Up @@ -315,7 +316,8 @@ ok - test_fake_exports_faked_in_subshells
ok - test_fake_transmits_params_to_fake_code
ok - test_fake_transmits_params_to_fake_code_as_array
ok - test_should_pretty_format_even_when_LANG_is_unset
1..30
ok - test_should_pretty_format_even_with_pipefail_set
1..31
```

== How to write tests
Expand Down
4 changes: 2 additions & 2 deletions bash_unit
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ pretty_format() {
if $term_utf8
then
echo -en " $pretty_symbol "
else
[[ -n "$alt_symbol" ]] && echo -en " $alt_symbol "
elif [[ -n "$alt_symbol" ]]; then
echo -en " $alt_symbol "
fi
) | color "$color"
}
Expand Down
9 changes: 9 additions & 0 deletions tests/test_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ test_should_pretty_format_even_when_LANG_is_unset() {
assert "echo foo | pretty_format GREEN I"
}

test_should_pretty_format_even_with_pipefail_set() {
# pretty_success must not fail when alt_symbol is empty with pipefail set.
(
set -o pipefail
unset LANG
assert "echo foo | pretty_success"
)
}

if [[ "${STICK_TO_CWD:-}" != true ]]
then
# do not test for cwd if STICK_TO_CWD is true
Expand Down
Loading