mirror of
https://github.com/jimeh/dotify.git
synced 2026-02-19 10:06:39 +00:00
Update test-helper.sh
This commit is contained in:
@@ -1,12 +1,39 @@
|
||||
[ -n "$TEST_DEBUG" ] && set -x
|
||||
|
||||
resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) $1
|
||||
}
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local path="$1"
|
||||
|
||||
while [ -n "$path" ]; do
|
||||
cd "${path%/*}"
|
||||
local name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
pwd
|
||||
cd "$cwd"
|
||||
}
|
||||
|
||||
# Set testroot variable.
|
||||
testroot="$(dirname "$BASH_SOURCE")"
|
||||
testroot="$(abs_dirname "$BASH_SOURCE")"
|
||||
|
||||
# Set root variable.
|
||||
root="$(abs_dirname "$testroot/../..")"
|
||||
|
||||
# Setup PATH environment variable.
|
||||
PATH="$root/bin:$root/libexec:$PATH"
|
||||
|
||||
# Include assert.sh testing library.
|
||||
source "$testroot/assert.sh"
|
||||
source "$testroot/stub.sh"
|
||||
source "${testroot}/assert.sh"
|
||||
source "${testroot}/stub.sh"
|
||||
|
||||
|
||||
#
|
||||
# Additional test helpers.
|
||||
# Test Helpers
|
||||
#
|
||||
|
||||
# Silent shortcut to "cd -".
|
||||
|
||||
Reference in New Issue
Block a user