Skip to content

DRAFT: BATS: unofficial strict mode #2032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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: 4 additions & 0 deletions test/bash_it/bash_it.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ function local_setup_file() {
# don't load any libraries as the tests here test the *whole* kit
}

function local_setup() {
: "${PROMPT_COMMAND:=}" "${BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE:=}"
}

@test "bash-it: verify that the test fixture is available" {
assert_file_exist "${BASH_IT?}/aliases/available/a.aliases.bash"
assert_file_exist "${BASH_IT?}/aliases/available/b.aliases.bash"
Expand Down
1 change: 1 addition & 0 deletions test/completion/bash-it.completion.bats
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function __check_completion() {

# Word index of the last word
COMP_CWORD=$((${#COMP_WORDS[@]} - 1))
COMP_WORDS+=('') # arg

# Run the Bash-it completion function
_bash-it
Expand Down
1 change: 1 addition & 0 deletions test/lib/helpers.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function local_setup_file() {
}

function local_setup() {
: "${BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE:=}"
# Copy the test fixture to the Bash-it folder
cp -RP "${BASH_IT?}/test/fixtures/bash_it"/* "${BASH_IT?}/"
}
Expand Down
1 change: 1 addition & 0 deletions test/lib/preexec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load ../test_helper
function local_setup {
setup_test_fixture
export __bp_enable_subshells=yas
export HISTCONTROL=""
}

@test "vendor preexec: __bp_install_after_session_init() without existing" {
Expand Down
2 changes: 2 additions & 0 deletions test/lib/utilities.bats
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"

function local_setup_file() {
setup_libs "helpers"
# shellcheck disable=SC2034
BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=""
}

@test "utilities: _is_function: _command_exists" {
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function setup() {
BASH_IT_CONFIG="${BASH_IT?}" #"${BATS_TEST_TMPDIR//\/\///}"
export XDG_CACHE_HOME="${BATS_TEST_TMPDIR?}"

set -Eeuo pipefail # Bash Unofficial Strict Mode
setup_test_fixture
local_setup
}
Expand All @@ -109,6 +110,7 @@ function teardown() {
unset GIT_CONFIG_NOSYSTEM
local_teardown
clean_test_fixture
set +Eeuo pipefail # Bash Unofficial Strict Mode
}

function teardown_file() {
Expand Down
Loading