2017-04-18 22:18:58 -04:00
|
|
|
test_description='can find python executable with different names'
|
|
|
|
. '../test-lib.bash'
|
|
|
|
|
|
|
|
# the test machine needs to have a binary named `python`
|
|
|
|
test_expect_success 'setup' '
|
|
|
|
mkdir ~/tmp_bin &&
|
|
|
|
(
|
|
|
|
IFS=:
|
|
|
|
for p in $PATH; do
|
2020-01-03 15:20:00 -05:00
|
|
|
if [ -d $p ]; then
|
|
|
|
find $p -maxdepth 1 -mindepth 1 -exec sh -c \
|
2017-04-18 22:18:58 -04:00
|
|
|
'"'"'ln -sf {} $HOME/tmp_bin/$(basename {})'"'"' \;
|
2020-01-03 15:20:00 -05:00
|
|
|
fi
|
2017-04-18 22:18:58 -04:00
|
|
|
done
|
|
|
|
) &&
|
|
|
|
rm -f ~/tmp_bin/python &&
|
|
|
|
rm -f ~/tmp_bin/python2 &&
|
|
|
|
rm -f ~/tmp_bin/python3
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_failure 'run' '
|
|
|
|
PATH="$HOME/tmp_bin" run_dotbot <<EOF
|
|
|
|
[]
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'setup 2' '
|
|
|
|
touch ~/tmp_bin/python &&
|
|
|
|
chmod +x ~/tmp_bin/python &&
|
|
|
|
cat >> ~/tmp_bin/python <<EOF
|
2018-03-27 21:18:39 -04:00
|
|
|
#!$HOME/tmp_bin/bash
|
2019-11-09 12:23:21 -05:00
|
|
|
exec $(command -v python)
|
2017-04-18 22:18:58 -04:00
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'run 2' '
|
|
|
|
PATH="$HOME/tmp_bin" run_dotbot <<EOF
|
|
|
|
[]
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'setup 3' '
|
|
|
|
mv ~/tmp_bin/python ~/tmp_bin/python2
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'run 3' '
|
|
|
|
PATH="$HOME/tmp_bin" run_dotbot <<EOF
|
|
|
|
[]
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'setup 4' '
|
|
|
|
mv ~/tmp_bin/python2 ~/tmp_bin/python3
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'run 4' '
|
|
|
|
PATH="$HOME/tmp_bin" run_dotbot <<EOF
|
|
|
|
[]
|
|
|
|
EOF
|
|
|
|
'
|