diff --git a/src/tmux_utils.sh b/src/tmux_utils.sh index 02dc33f..87ab063 100644 --- a/src/tmux_utils.sh +++ b/src/tmux_utils.sh @@ -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" -} diff --git a/tests/linux/test_check_gruvbox_dark256_enabled.sh b/tests/linux/test_check_gruvbox_dark256_enabled.sh index 9e4d17c..aad203f 100755 --- a/tests/linux/test_check_gruvbox_dark256_enabled.sh +++ b/tests/linux/test_check_gruvbox_dark256_enabled.sh @@ -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 @@ -33,7 +33,7 @@ EOF # check if left side match _status_left_expected="#[bg=colour241,fg=colour248] #S #[bg=colour237,fg=colour241,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -41,7 +41,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=colour237,fg=colour223" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_check_gruvbox_dark256_transparent_enabled.sh b/tests/linux/test_check_gruvbox_dark256_transparent_enabled.sh index 274e778..76fcfdc 100755 --- a/tests/linux/test_check_gruvbox_dark256_transparent_enabled.sh +++ b/tests/linux/test_check_gruvbox_dark256_transparent_enabled.sh @@ -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 @@ -34,7 +34,7 @@ EOF # check if left side match _status_left_expected="#[bg=colour241,fg=colour248] #S #[bg=colour237,fg=colour241,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -42,7 +42,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=default,fg=colour223" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_check_gruvbox_dark_enabled.sh b/tests/linux/test_check_gruvbox_dark_enabled.sh index 17b9bb9..e8d0505 100755 --- a/tests/linux/test_check_gruvbox_dark_enabled.sh +++ b/tests/linux/test_check_gruvbox_dark_enabled.sh @@ -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 @@ -33,7 +33,7 @@ EOF # check if left side match _status_left_expected="#[bg=#665c54,fg=#bdae93] #S #[bg=#3c3836,fg=#665c54,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -41,7 +41,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=#3c3836,fg=#ebdbb2" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_check_gruvbox_dark_transparent_enabled.sh b/tests/linux/test_check_gruvbox_dark_transparent_enabled.sh index 42a1213..fff0358 100755 --- a/tests/linux/test_check_gruvbox_dark_transparent_enabled.sh +++ b/tests/linux/test_check_gruvbox_dark_transparent_enabled.sh @@ -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 @@ -34,7 +34,7 @@ EOF # check if left side match _status_left_expected="#[bg=#665c54,fg=#bdae93] #S #[bg=#3c3836,fg=#665c54,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -42,7 +42,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=default,fg=#ebdbb2" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_check_gruvbox_light256_enabled.sh b/tests/linux/test_check_gruvbox_light256_enabled.sh index 7c55396..b9bfcd7 100755 --- a/tests/linux/test_check_gruvbox_light256_enabled.sh +++ b/tests/linux/test_check_gruvbox_light256_enabled.sh @@ -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 @@ -33,7 +33,7 @@ EOF # check if left side match _status_left_expected="#[bg=colour239,fg=colour223] #S #[bg=colour250,fg=colour239,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -41,7 +41,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=colour250,fg=colour237" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_check_gruvbox_light256_transparent_enabled.sh b/tests/linux/test_check_gruvbox_light256_transparent_enabled.sh index ccf17a5..b8cf8a6 100755 --- a/tests/linux/test_check_gruvbox_light256_transparent_enabled.sh +++ b/tests/linux/test_check_gruvbox_light256_transparent_enabled.sh @@ -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 @@ -34,7 +36,7 @@ EOF # check if left side match _status_left_expected="#[bg=colour239,fg=colour223] #S #[bg=colour250,fg=colour239,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -42,7 +44,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=default,fg=colour237" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_check_gruvbox_light_enabled.sh b/tests/linux/test_check_gruvbox_light_enabled.sh index db65da7..8c4404f 100755 --- a/tests/linux/test_check_gruvbox_light_enabled.sh +++ b/tests/linux/test_check_gruvbox_light_enabled.sh @@ -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 @@ -33,7 +33,7 @@ EOF # check if left side match _status_left_expected="#[bg=#bdae93,fg=#665c54] #S #[bg=#ebdbb2,fg=#bdae93,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -41,7 +41,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=#ebdbb2,fg=#3c3836" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_check_gruvbox_light_transparent_enabled.sh b/tests/linux/test_check_gruvbox_light_transparent_enabled.sh index c12fab1..309fc6f 100755 --- a/tests/linux/test_check_gruvbox_light_transparent_enabled.sh +++ b/tests/linux/test_check_gruvbox_light_transparent_enabled.sh @@ -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 @@ -34,7 +34,7 @@ EOF # check if left side match _status_left_expected="#[bg=#bdae93,fg=#665c54] #S #[bg=#ebdbb2,fg=#bdae93,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -42,7 +42,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=default,fg=#3c3836" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/linux/test_without_theme_fallback_to_gruvbox_dark256.sh b/tests/linux/test_without_theme_fallback_to_gruvbox_dark256.sh index 058ded6..b150655 100755 --- a/tests/linux/test_without_theme_fallback_to_gruvbox_dark256.sh +++ b/tests/linux/test_without_theme_fallback_to_gruvbox_dark256.sh @@ -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' @@ -36,7 +36,7 @@ EOF # check if left side match _status_left_expected="#[bg=colour241,fg=colour248] #S #[bg=colour237,fg=colour241,nobold,noitalics,nounderscore]" - _status_left_current=$(tmux_get_statusleft) + _status_left_current=$(helper_tmux_get_statusleft) if [[ "$_status_left_current" != "$_status_left_expected" ]]; then helper_print_fail "status-left did not match" "$_status_left_current" "$_status_left_expected" helper_teardown @@ -44,7 +44,7 @@ EOF fi # check if status is not transparent _status_style_expected="bg=colour237,fg=colour223" - _status_style_current=$(tmux_get_statusstyle) + _status_style_current=$(helper_tmux_get_statusstyle) if [[ "$_status_style_current" != "$_status_style_expected" ]]; then helper_print_fail "status-style did not match" "$_status_style_current" "$_status_style_expected" helper_teardown diff --git a/tests/tmux_helpers.sh b/tests/test_helpers.sh similarity index 77% rename from tests/tmux_helpers.sh rename to tests/test_helpers.sh index c07f217..7b199a4 100644 --- a/tests/tmux_helpers.sh +++ b/tests/test_helpers.sh @@ -33,7 +33,7 @@ helper_print_fail() { } helper_print_success() { - local _msg="${1:-}" + local _msg="${1}" printf "SUCCESS. %s\n" "${_msg}" } @@ -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" }