Skip to content

Commit

Permalink
chore: simplify skip with return
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Nov 9, 2024
1 parent d2b9862 commit daa5527
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
3 changes: 0 additions & 3 deletions src/skip_todo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ function skip() {
console_results::print_skipped_test "${label}" "${reason}"

state::add_assertions_skipped

# Stop the current test function execution
return 0
}

function todo() {
Expand Down
20 changes: 9 additions & 11 deletions tests/acceptance/bashunit_upgrade_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ function tear_down() {
}

function test_do_not_upgrade_when_latest() {
skip "failing when having a new release"
return
# local output
# output="$($TMP_BIN --upgrade)"
#
# assert_same "> You are already on latest version" "$output"
# assert_string_ends_with "$LATEST_VERSION" "$($TMP_BIN --version --env "$TEST_ENV_FILE")"
skip "failing when having a new release" && return

local output
output="$($TMP_BIN --upgrade)"

assert_same "> You are already on latest version" "$output"
assert_string_ends_with "$LATEST_VERSION" "$($TMP_BIN --version --env "$TEST_ENV_FILE")"
}

function test_upgrade_when_a_new_version_found() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
skip "no internet connection" && return
fi

sed -i -e \
Expand All @@ -59,8 +58,7 @@ function test_upgrade_when_a_new_version_found() {

function test_do_not_update_on_consecutive_calls() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
skip "no internet connection" && return
fi

sed -i -e \
Expand Down
12 changes: 4 additions & 8 deletions tests/acceptance/install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ function tear_down() {

function test_install_downloads_the_latest_version() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
skip "no internet connection" && return
fi

local installed_bashunit="./lib/bashunit"
Expand All @@ -47,8 +46,7 @@ function test_install_downloads_the_latest_version() {

function test_install_downloads_in_given_folder() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
skip "no internet connection" && return
fi

local installed_bashunit="./deps/bashunit"
Expand All @@ -67,8 +65,7 @@ function test_install_downloads_in_given_folder() {

function test_install_downloads_the_given_version() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
skip "no internet connection" && return
fi

local installed_bashunit="./lib/bashunit"
Expand All @@ -89,8 +86,7 @@ function test_install_downloads_the_given_version() {

function test_install_downloads_the_non_stable_beta_version() {
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
skip "no internet connection"
return
skip "no internet connection" && return
fi

mock date echo "2023-11-13"
Expand Down

0 comments on commit daa5527

Please sign in to comment.