test/theme: adopt newly revamped `setup()`

pull/2031/head
John D Pell 2022-01-31 11:09:20 -08:00 committed by John D Pell
parent b686515877
commit f0dfe1a67f
3 changed files with 28 additions and 39 deletions

View File

@ -1,8 +1,11 @@
#!/usr/bin/env bats
# shellcheck shell=bats
load ../test_helper
load ../test_helper_libs
load ../../themes/base.theme
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
function local_setup_file() {
setup_libs "colors" #"theme"
load "${BASH_IT?}/themes/base.theme.bash"
}
@test 'themes base: battery_percentage should not exist' {
run type -a battery_percentage &> /dev/null
@ -10,7 +13,7 @@ load ../../themes/base.theme
}
@test 'themes base: battery_percentage should exist if battery plugin loaded' {
load ../../plugins/available/battery.plugin
load "${BASH_IT?}/plugins/available/battery.plugin.bash"
run type -a battery_percentage &> /dev/null
assert_success
@ -28,12 +31,12 @@ load ../../themes/base.theme
@test 'themes base: battery_char should exist if battery plugin loaded' {
unset -f battery_char
load ../../plugins/available/battery.plugin
load "${BASH_IT?}/plugins/available/battery.plugin.bash"
run type -t battery_percentage
assert_success
assert_line "function"
load ../../themes/base.theme
load "${BASH_IT?}/themes/base.theme.bash"
run type -t battery_char
assert_success
assert_line "function"
@ -51,13 +54,13 @@ load ../../themes/base.theme
run battery_charge
assert_success
assert_line -n 0 ""
assert_output ""
}
@test 'themes base: battery_charge should exist if battery plugin loaded' {
unset -f battery_charge
load ../../plugins/available/battery.plugin
load ../../themes/base.theme
load "${BASH_IT?}/plugins/available/battery.plugin.bash"
load "${BASH_IT?}/themes/base.theme.bash"
run type -a battery_charge &> /dev/null
assert_success

View File

@ -1,9 +1,14 @@
#!/usr/bin/env bats
# shellcheck shell=bats
# shellcheck disable=SC2034
# shellcheck disable=SC2016
load ../test_helper
load ../test_helper_libs
load ../../themes/githelpers.theme
load ../../themes/base.theme
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
function local_setup_file() {
setup_libs "colors" #"theme"
load "${BASH_IT?}/themes/base.theme.bash"
load "${BASH_IT?}/themes/githelpers.theme.bash"
}
add_commit() {
local file_name="general-${RANDOM}"

View File

@ -1,29 +1,10 @@
#!/usr/bin/env bats
# shellcheck shell=bats
load ../test_helper
load ../test_helper_libs
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
function local_setup {
setup_test_fixture
# Copy the test fixture to the Bash-it folder
if command -v rsync &> /dev/null
then
rsync -a "$BASH_IT/test/fixtures/bash_it/" "$BASH_IT/"
else
find "$BASH_IT/test/fixtures/bash_it" \
-mindepth 1 -maxdepth 1 \
-exec cp -r {} "$BASH_IT/" \;
fi
export OLD_PATH="$PATH"
load ../../themes/base.theme
}
function local_teardown {
export PATH="$OLD_PATH"
unset OLD_PATH
function local_setup_file() {
setup_libs "colors" #"theme"
load "${BASH_IT?}/themes/base.theme.bash"
}
function setup_repo {