Skip to content

Commit 6948f55

Browse files
committed
test: Naming and variable improvements
1 parent 2291e66 commit 6948f55

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

tests/util/init.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ export BPM_ORIGIN_DIR="$BPM_TEST_DIR/origin"
1818
export BPM_IS_TEST=
1919

2020
# Stub common variables
21+
test_util.get_repo_root
22+
export BPM_ROOT="${REPLY%/*}"
2123
export PROGRAM_LIB_DIR="$BPM_ROOT/source/pkg/lib"
22-
test_util.get_bpm_root
23-
export BPM_ROOT="$REPLY"
2424
export BPM_PREFIX="$BPM_TEST_DIR/cellar"
2525
export BPM_PACKAGES_PATH="$BPM_PREFIX/packages"
2626
export BPM_INSTALL_BIN="$BPM_PREFIX/bin"
2727
export BPM_INSTALL_MAN="$BPM_PREFIX/man"
2828
export BPM_INSTALL_COMPLETIONS="$BPM_PREFIX/completions"
29-
export BPM_MODE='global' # normal default is 'local'
29+
export BPM_MODE='global' # for non-tests, the default is 'local'
3030

3131
export PATH="$BPM_ROOT/source/pkg/bin:$PATH"
3232
for f in "$BPM_ROOT"/source/pkg/lib/{commands,util}/?*.sh; do

tests/util/test_util.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# shellcheck shell=bash
22
# shellcheck disable=SC2164
33

4-
test_util.get_bpm_root() {
4+
test_util.get_repo_root() {
55
REPLY=
66
if ! REPLY="$(
77
while [[ ! -d ".git" && "$PWD" != / ]]; do
@@ -16,12 +16,6 @@ test_util.get_bpm_root() {
1616
exit 1
1717
fi
1818
19-
# BPM root is the parent directory of 'source', which holds
20-
# the Git repository
21-
if ! cd ..; then
22-
printf "%s\n" "Error: Could not cd to BPM directory" >&2
23-
exit 1
24-
fi
2519
printf "%s" "$PWD"
2620
)"; then
2721
exit 1

0 commit comments

Comments
 (0)