diff options
author | Kevin Ballard <kevin@sb.org> | 2014-09-20 00:26:10 -0700 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2014-09-20 00:31:33 -0700 |
commit | 8a3cf144f25dd0cb1e20928b2c2f2c53b34c40c3 (patch) | |
tree | 362fd43b490ecea73a023f249106bf9e35455ff7 /tests/test6.in | |
parent | a381ac2691b7c1d52ec7436a7c97ba91b3d496aa (diff) |
Don't include child directories of $PATH in completions
Directories are completed like commands, because of implicit cd.
However, directories found inside $PATH entries should not be completed,
as implicit cd doesn't work there. Similarly, directories should not be
completed after the `command` builtin.
Fixes #1695.
Diffstat (limited to 'tests/test6.in')
-rwxr-xr-x | tests/test6.in | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test6.in b/tests/test6.in index 93be594a..9a441b65 100755 --- a/tests/test6.in +++ b/tests/test6.in @@ -1,3 +1,4 @@ +# vim: set filetype=fish: # 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) @@ -43,3 +44,31 @@ complete -C'CCCC -' | sort complete -c CCCC -e echo "CCCC:" complete -C'CCCC -' | sort + +# 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 + set -l PATH $PWD/test6.tmp.dir $PATH + 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 |