2014-09-20 07:26:10 +00:00
|
|
|
# vim: set filetype=fish:
|
2012-05-12 01:59:38 +00:00
|
|
|
|
|
|
|
# Test that conditions that add or remove completions don't deadlock, etc.
|
|
|
|
# We actually encountered some case that was effectively like this (Issue 2 in github)
|
|
|
|
|
|
|
|
complete --command AAAA -l abcd --condition 'complete -c AAAA -l efgh'
|
2014-09-02 22:25:45 +00:00
|
|
|
echo "AAAA:"
|
|
|
|
complete -C'AAAA -' | sort
|
|
|
|
echo "AAAA:"
|
|
|
|
complete -C'AAAA -' | sort
|
2012-05-12 01:59:38 +00:00
|
|
|
|
|
|
|
complete --command BBBB -l abcd --condition 'complete -e --command BBBB -l abcd'
|
2014-09-02 22:25:45 +00:00
|
|
|
echo "BBBB:"
|
2012-05-12 01:59:38 +00:00
|
|
|
complete -C'BBBB -'
|
2014-09-02 22:25:45 +00:00
|
|
|
echo "BBBB:"
|
2012-05-12 01:59:38 +00:00
|
|
|
complete -C'BBBB -'
|
2014-09-02 22:25:45 +00:00
|
|
|
|
|
|
|
# Test that erasing completions works correctly
|
|
|
|
echo
|
|
|
|
|
2014-09-02 22:52:56 +00:00
|
|
|
function sort
|
|
|
|
# GNU sort is really stupid, a non-C locale seems to make it assume --dictionary-order
|
|
|
|
# If I wanted --dictionary-order, I would have specified --dictionary-order!
|
|
|
|
env LC_ALL=C sort $argv
|
|
|
|
end
|
|
|
|
|
2014-09-02 22:25:45 +00:00
|
|
|
complete -c CCCC -l bar
|
|
|
|
complete -c CCCC -l baz
|
|
|
|
complete -c CCCC -o bar
|
|
|
|
complete -c CCCC -o foo
|
|
|
|
complete -c CCCC -s a
|
|
|
|
complete -c CCCC -s b
|
|
|
|
echo "CCCC:"
|
|
|
|
complete -C'CCCC -' | sort
|
|
|
|
complete -c CCCC -l bar -e
|
|
|
|
echo "CCCC:"
|
|
|
|
complete -C'CCCC -' | sort
|
|
|
|
complete -c CCCC -o foo -e
|
|
|
|
echo "CCCC:"
|
|
|
|
complete -C'CCCC -' | sort
|
|
|
|
complete -c CCCC -s a -e
|
|
|
|
echo "CCCC:"
|
|
|
|
complete -C'CCCC -' | sort
|
|
|
|
complete -c CCCC -e
|
|
|
|
echo "CCCC:"
|
|
|
|
complete -C'CCCC -' | sort
|
2014-09-20 07:26:10 +00:00
|
|
|
|
|
|
|
# Test that directory completions work correctly
|
|
|
|
if begin; rm -rf test6.tmp.dir; and mkdir test6.tmp.dir; end
|
|
|
|
pushd test6.tmp.dir
|
|
|
|
set -l dir (mktemp -d XXXXXXXX)
|
|
|
|
if complete -C$dir | grep "^$dir/.*Directory" >/dev/null
|
|
|
|
echo "implicit cd complete works"
|
|
|
|
else
|
|
|
|
echo "no implicit cd complete"
|
|
|
|
end
|
|
|
|
if complete -C"command $dir" | grep "^$dir/.*Directory" >/dev/null
|
|
|
|
echo "implicit cd complete incorrect after 'command'"
|
|
|
|
else
|
|
|
|
echo "no implicit cd complete after 'command'"
|
|
|
|
end
|
|
|
|
popd
|
|
|
|
if begin
|
2014-09-20 07:35:51 +00:00
|
|
|
set -l PATH $PWD/test6.tmp.dir $PATH ^/dev/null
|
2014-09-20 07:26:10 +00:00
|
|
|
complete -C$dir | grep "^$dir/.*Directory" >/dev/null
|
|
|
|
end
|
|
|
|
echo "incorrect implicit cd from PATH"
|
|
|
|
else
|
|
|
|
echo "PATH does not cause incorrect implicit cd"
|
|
|
|
end
|
|
|
|
rm -rf test6.tmp.dir
|
|
|
|
else
|
|
|
|
echo "error: could not create temp environment" >&2
|
|
|
|
end
|