From 77916f056a6e6a295ef07482424018dc338f4b1a Mon Sep 17 00:00:00 2001 From: Wilhelmina Drengwitz Date: Tue, 7 Feb 2017 21:20:17 -0500 Subject: [PATCH] Add bash & zsh compatible way to resolve abs exe paths --- test/lib/git/shell_shortcuts_test.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/lib/git/shell_shortcuts_test.sh b/test/lib/git/shell_shortcuts_test.sh index 8bae83e..f699085 100755 --- a/test/lib/git/shell_shortcuts_test.sh +++ b/test/lib/git/shell_shortcuts_test.sh @@ -21,6 +21,13 @@ fi source "$scmbDir/test/support/test_helper.sh" source "$scmbDir/lib/scm_breeze.sh" +bin_path() { + if [ -n "${ZSH_VERSION:-}" ]; + then where "$@" | tail -1 + else which "$@" + fi +} + # Setup #----------------------------------------------------------------------------- oneTimeSetUp() { @@ -35,10 +42,10 @@ oneTimeSetUp() { # Before aliasing, get original locations so we can compare them in the test unalias mv rm sed cat 2>/dev/null - export mv_path="$(which mv)" - export rm_path="$(which rm)" - export sed_path="$(which sed)" - export cat_path="$(which cat)" + export mv_path="$(bin_path mv)" + export rm_path="$(bin_path rm)" + export sed_path="$(bin_path sed)" + export cat_path="$(bin_path cat)" # Test aliases alias mv="nocorrect $mv_path"