Skip to content

Commit

Permalink
test: add redirect_error_without_log
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Jun 22, 2024
1 parent 3d2fb77 commit 37b6688
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/unit/redirect_error_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ function tear_down() {
rm $_ERROR_LOG
}

function test_redirect_error() {

function render_into_error_fd_and_exit() {
echo "$*" >&2
exit 1
}

function test_redirect_error_with_log() {
exec 2>&3 2>$_ERROR_LOG

_="$(render_into_error_fd_and_exit "arg1" "arg2")"
Expand All @@ -22,3 +16,15 @@ function test_redirect_error() {
error_output=$(<$_ERROR_LOG)
assert_equals "arg1 arg2" "$error_output"
}

function test_redirect_error_without_log() {
exec 2>&3 2>/dev/null

_="$(render_into_error_fd_and_exit "...args")"
assert_general_error
}

function render_into_error_fd_and_exit() {
echo "$*" >&2
exit 1
}

0 comments on commit 37b6688

Please sign in to comment.