Skip to content

Commit 46f94b6

Browse files
committed
test: skip mock/spy external script tests on Bash 3.0
1 parent bfd3d97 commit 46f94b6

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

tests/acceptance/install_test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ function test_install_downloads_the_given_version_without_dir() {
130130
}
131131

132132
function test_install_downloads_the_non_stable_beta_version() {
133+
# Skip on Bash 3.0 - mocks don't work for external scripts
134+
if [[ "${BASH_VERSINFO[0]}" -eq 3 ]] && [[ "${BASH_VERSINFO[1]}" -lt 1 ]]; then
135+
bashunit::skip "Mocks don't work for external scripts in Bash 3.0"
136+
return
137+
fi
133138
if [[ "$ACTIVE_INTERNET" -eq 1 ]]; then
134139
bashunit::skip "no internet connection" && return
135140
fi

tests/functional/doubles_test.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ function test_mock_ps_when_executing_a_sourced_function() {
1616
}
1717

1818
function test_spy_commands_called_when_executing_a_script() {
19+
# Skip on Bash 3.0 - shell function exports don't work for external scripts
20+
if [[ "${BASH_VERSINFO[0]}" -eq 3 ]] && [[ "${BASH_VERSINFO[1]}" -lt 1 ]]; then
21+
bashunit::skip "Spies don't work for external scripts in Bash 3.0"
22+
return
23+
fi
24+
1925
bashunit::spy ps
2026
bashunit::spy awk
2127
bashunit::spy head
@@ -41,6 +47,11 @@ function test_spy_commands_called_when_executing_a_sourced_function() {
4147
}
4248

4349
function test_spy_commands_called_once_when_executing_a_script() {
50+
# Skip on Bash 3.0 - shell function exports don't work for external scripts
51+
if [[ "${BASH_VERSINFO[0]}" -eq 3 ]] && [[ "${BASH_VERSINFO[1]}" -lt 1 ]]; then
52+
bashunit::skip "Spies don't work for external scripts in Bash 3.0"
53+
return
54+
fi
4455
# Skip when coverage is enabled because coverage uses head internally,
4556
# which interferes with spying on head
4657
if bashunit::env::is_coverage_enabled; then

0 commit comments

Comments
 (0)