Skip to content

Commit 1eded02

Browse files
committed
test: Add 'REPO_ROOT' variable
1 parent 6948f55 commit 1eded02

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tests/bpm-load.bats

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ load 'util/init.sh'
1111
}; test_util.finish_pkg
1212
test_util.mock_add "$pkg"
1313

14-
BPM_ROOT="${BPM_PACKAGES_PATH%/*}"
15-
BPM_ROOT="${BPM_ROOT%/*}"
14+
BPM_ROOT="$BPM_TEST_DIR"
1615

1716
source bpm-load
1817
run bpm-load --global "$pkg"

tests/util/init.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,26 @@ export LANGUAGE="C"
1212
export LC_ALL="C"
1313
export XDG_DATA_HOME=
1414

15+
# When doing tests
1516
# Test-specific
1617
export BPM_TEST_DIR="$BATS_TMPDIR/bpm"
1718
export BPM_ORIGIN_DIR="$BPM_TEST_DIR/origin"
1819
export BPM_IS_TEST=
1920

2021
# Stub common variables
2122
test_util.get_repo_root
22-
export BPM_ROOT="${REPLY%/*}"
23-
export PROGRAM_LIB_DIR="$BPM_ROOT/source/pkg/lib"
23+
export REPO_ROOT="$REPLY"
24+
export BPM_ROOT="${REPO_ROOT%/*}"
25+
export PROGRAM_LIB_DIR="$REPO_ROOT/pkg/lib"
2426
export BPM_PREFIX="$BPM_TEST_DIR/cellar"
2527
export BPM_PACKAGES_PATH="$BPM_PREFIX/packages"
2628
export BPM_INSTALL_BIN="$BPM_PREFIX/bin"
2729
export BPM_INSTALL_MAN="$BPM_PREFIX/man"
2830
export BPM_INSTALL_COMPLETIONS="$BPM_PREFIX/completions"
2931
export BPM_MODE='global' # for non-tests, the default is 'local'
3032

31-
export PATH="$BPM_ROOT/source/pkg/bin:$PATH"
32-
for f in "$BPM_ROOT"/source/pkg/lib/{commands,util}/?*.sh; do
33+
export PATH="$REPO_ROOT/pkg/bin:$PATH"
34+
for f in "$REPO_ROOT"/pkg/lib/{commands,util}/?*.sh; do
3335
source "$f"
3436
done
3537

0 commit comments

Comments
 (0)