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: 2 additions & 2 deletions src/assert_failure.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ assert_failure() {
if (( status == 0 )); then
{ local -ir width=6
batslib_print_kv_single_or_multi "$width" 'output' "$output"
if [[ -n "$stderr" ]]; then
if [[ -n "${stderr-}" ]]; then
batslib_print_kv_single_or_multi "$width" 'stderr' "$stderr"
fi
} \
Expand All @@ -76,7 +76,7 @@ assert_failure() {
'actual' "$status"
batslib_print_kv_single_or_multi "$width" \
'output' "$output"
if [[ -n "$stderr" ]]; then
if [[ -n "${stderr-}" ]]; then
batslib_print_kv_single_or_multi "$width" 'stderr' "$stderr"
fi
} \
Expand Down
2 changes: 1 addition & 1 deletion src/assert_success.bash
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ assert_success() {
{ local -ir width=6
batslib_print_kv_single "$width" 'status' "$status"
batslib_print_kv_single_or_multi "$width" 'output' "$output"
if [[ -n "$stderr" ]]; then
if [[ -n "${stderr-}" ]]; then
batslib_print_kv_single_or_multi "$width" 'stderr' "$stderr"
fi
} \
Expand Down
4 changes: 2 additions & 2 deletions test/assert_failure.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ ERR_MSG
}

@test "assert_failure(): returns 1 and displays \`\$stderr' if it is set" {
bats_require_minimum_version 1.5.0
run --separate-stderr \
bash -c 'echo "a"
echo "b" >&2
exit 0'
echo "Stderr: $stderr" >&3
run assert_failure

echo "Stderr: $stderr" >&3

assert_test_fail <<'ERR_MSG'

-- command succeeded, but it was expected to fail --
Expand Down
1 change: 1 addition & 0 deletions test/assert_success.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ERR_MSG
}

@test "assert_success(): displays \`\$stderr' if it is set" {
bats_require_minimum_version 1.5.0
run --separate-stderr \
bash -c 'echo "a"
echo "b" >&2
Expand Down
2 changes: 1 addition & 1 deletion test/refute_stderr.bats
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ ERR_MSG
}

@test "refute_stderr(): \`--' stops parsing options" {
run echo_err '--'
run --separate-stderr echo_err '--'
run refute_stderr -- '-p'
assert_test_pass
}