mirror of
https://github.com/jimeh/dotify.git
synced 2026-02-19 10:06:39 +00:00
Fix a bug in test-helper.sh
This commit is contained in:
@@ -29,13 +29,13 @@ stub() {
|
|||||||
# Restore the original command/function that was stubbed with stub.
|
# Restore the original command/function that was stubbed with stub.
|
||||||
restore() {
|
restore() {
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
unset "$cmd"
|
unset -f "$cmd"
|
||||||
if type "original_${cmd}" &>/dev/null; then
|
if type "original_${cmd}" &>/dev/null; then
|
||||||
if [[ "$(type "original_${cmd}" | head -1)" == *"is a function" ]]; then
|
if [[ "$(type "original_${cmd}" | head -1)" == *"is a function" ]]; then
|
||||||
local source="$(type "original_$cmd" | tail -n +2)"
|
local source="$(type "original_$cmd" | tail -n +2)"
|
||||||
source="${source/original_${cmd}/$cmd}"
|
source="${source/original_${cmd}/$cmd}"
|
||||||
eval "$source"
|
eval "$source"
|
||||||
unset "original_${cmd}"
|
unset -f "original_${cmd}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user