Skip to content

Commit

Permalink
refactor: improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
egel committed Sep 22, 2024
1 parent dd1c215 commit 60e061d
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 26 deletions.
13 changes: 0 additions & 13 deletions src/tmux_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,3 @@ tmux_set_window_option_now() {
_value="$2"
tmux set-window-option -gq "$_option_name" "$_value"
}

# return the value of status style
tmux_get_statusstyle() {
local _val
_val=$(tmux show-option -gqv status-style)
echo "$_val"
}

tmux_get_statusleft() {
local _val
_val=$(tmux show-option -gqv status-left)
echo "$_val"
}
2 changes: 1 addition & 1 deletion tests/linux/test_check_gruvbox_dark256_enabled.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

main() {
helper_tearup_linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

main() {
helper_tearup_linux
Expand Down
2 changes: 1 addition & 1 deletion tests/linux/test_check_gruvbox_dark_enabled.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

main() {
helper_tearup_linux
Expand Down
2 changes: 1 addition & 1 deletion tests/linux/test_check_gruvbox_dark_transparent_enabled.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

main() {
helper_tearup_linux
Expand Down
2 changes: 1 addition & 1 deletion tests/linux/test_check_gruvbox_light256_enabled.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

main() {
helper_tearup_linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"
# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_utils.sh"

main() {
helper_tearup_linux
Expand Down
2 changes: 1 addition & 1 deletion tests/linux/test_check_gruvbox_light_enabled.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

main() {
helper_tearup_linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

main() {
helper_tearup_linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# shellcheck disable=SC1091
source "${CURRENT_DIR}/../tmux_helpers.sh"
source "${CURRENT_DIR}/../test_helpers.sh"

####
# Test: when the theme is not defined in config it should fallback to 'dark256'
Expand Down
17 changes: 13 additions & 4 deletions tests/tmux_helpers.sh → tests/test_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ helper_print_fail() {
}

helper_print_success() {
local _msg="${1:-}"
local _msg="${1}"
printf "SUCCESS. %s\n" "${_msg}"
}

Expand All @@ -52,7 +52,16 @@ helper_install_tpm_plugins() {
bash -c "${HOME}/.tmux/plugins/tpm/scripts/install_plugins.sh install_plugins"
}

helper_get_project_root_dir() {
_current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "${_current_dir}/../"
# return the value of tmux status-style
helper_tmux_get_statusstyle() {
local _val
_val=$(tmux show-option -gqv status-style)
echo "$_val"
}

# return the value of tmux status-left
helper_tmux_get_statusleft() {
local _val
_val=$(tmux show-option -gqv status-left)
echo "$_val"
}

0 comments on commit 60e061d

Please sign in to comment.