Skip to content

Commit f0dfe1a

Browse files
committed
test/theme: adopt newly revamped setup()
1 parent b686515 commit f0dfe1a

File tree

3 files changed

+28
-39
lines changed

3 files changed

+28
-39
lines changed

test/themes/base.theme.bats

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
#!/usr/bin/env bats
1+
# shellcheck shell=bats
22

3-
load ../test_helper
4-
load ../test_helper_libs
5-
load ../../themes/base.theme
3+
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
4+
5+
function local_setup_file() {
6+
setup_libs "colors" #"theme"
7+
load "${BASH_IT?}/themes/base.theme.bash"
8+
}
69

710
@test 'themes base: battery_percentage should not exist' {
811
run type -a battery_percentage &> /dev/null
912
assert_failure
1013
}
1114

1215
@test 'themes base: battery_percentage should exist if battery plugin loaded' {
13-
load ../../plugins/available/battery.plugin
16+
load "${BASH_IT?}/plugins/available/battery.plugin.bash"
1417

1518
run type -a battery_percentage &> /dev/null
1619
assert_success
@@ -28,12 +31,12 @@ load ../../themes/base.theme
2831
@test 'themes base: battery_char should exist if battery plugin loaded' {
2932
unset -f battery_char
3033

31-
load ../../plugins/available/battery.plugin
34+
load "${BASH_IT?}/plugins/available/battery.plugin.bash"
3235
run type -t battery_percentage
3336
assert_success
3437
assert_line "function"
3538

36-
load ../../themes/base.theme
39+
load "${BASH_IT?}/themes/base.theme.bash"
3740
run type -t battery_char
3841
assert_success
3942
assert_line "function"
@@ -51,13 +54,13 @@ load ../../themes/base.theme
5154

5255
run battery_charge
5356
assert_success
54-
assert_line -n 0 ""
57+
assert_output ""
5558
}
5659

5760
@test 'themes base: battery_charge should exist if battery plugin loaded' {
5861
unset -f battery_charge
59-
load ../../plugins/available/battery.plugin
60-
load ../../themes/base.theme
62+
load "${BASH_IT?}/plugins/available/battery.plugin.bash"
63+
load "${BASH_IT?}/themes/base.theme.bash"
6164

6265
run type -a battery_charge &> /dev/null
6366
assert_success

test/themes/base.theme.git.bats

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
#!/usr/bin/env bats
1+
# shellcheck shell=bats
2+
# shellcheck disable=SC2034
3+
# shellcheck disable=SC2016
24

3-
load ../test_helper
4-
load ../test_helper_libs
5-
load ../../themes/githelpers.theme
6-
load ../../themes/base.theme
5+
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
6+
7+
function local_setup_file() {
8+
setup_libs "colors" #"theme"
9+
load "${BASH_IT?}/themes/base.theme.bash"
10+
load "${BASH_IT?}/themes/githelpers.theme.bash"
11+
}
712

813
add_commit() {
914
local file_name="general-${RANDOM}"

test/themes/base.theme.svn.bats

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
#!/usr/bin/env bats
1+
# shellcheck shell=bats
22

3-
load ../test_helper
4-
load ../test_helper_libs
3+
load "${MAIN_BASH_IT_DIR?}/test/test_helper.bash"
54

6-
function local_setup {
7-
setup_test_fixture
8-
9-
# Copy the test fixture to the Bash-it folder
10-
if command -v rsync &> /dev/null
11-
then
12-
rsync -a "$BASH_IT/test/fixtures/bash_it/" "$BASH_IT/"
13-
else
14-
find "$BASH_IT/test/fixtures/bash_it" \
15-
-mindepth 1 -maxdepth 1 \
16-
-exec cp -r {} "$BASH_IT/" \;
17-
fi
18-
19-
export OLD_PATH="$PATH"
20-
21-
load ../../themes/base.theme
22-
}
23-
24-
function local_teardown {
25-
export PATH="$OLD_PATH"
26-
unset OLD_PATH
5+
function local_setup_file() {
6+
setup_libs "colors" #"theme"
7+
load "${BASH_IT?}/themes/base.theme.bash"
278
}
289

2910
function setup_repo {

0 commit comments

Comments
 (0)