1
0
mirror of https://github.com/sstephenson/bats.git synced 2026-02-25 09:18:10 +01:00

Make load handle absolute paths too

Add 2 simple tests on this.
This commit is contained in:
Andrey Mazo
2014-05-21 00:10:55 -04:00
parent 2476770c84
commit 35f963010d
2 changed files with 19 additions and 2 deletions

View File

@@ -30,13 +30,20 @@ BATS_TEST_DIRNAME="$(dirname "$BATS_TEST_FILENAME")"
BATS_TEST_NAMES=()
load() {
local filename="$BATS_TEST_DIRNAME/$1.bash"
local inc="$1"
local filename
if [[ "${inc}" == "/"* ]] ; then
filename="${inc}"
else
filename="$BATS_TEST_DIRNAME/${inc}.bash"
fi
[ -f "$filename" ] || {
echo "bats: $filename does not exist" >&2
exit 1
}
source "$BATS_TEST_DIRNAME/$1.bash"
source "${filename}"
}
run() {