Add a new completion test for optional arguments

This commit is contained in:
ridiculousfish 2016-12-21 15:46:32 -08:00
parent 96157a05f6
commit dce9453d25
2 changed files with 7 additions and 0 deletions

View file

@ -67,6 +67,11 @@ echo "Expect -AQ -AW:" (complete -C'TestExclusive -A' | sort | string join ' ')
echo "Expect no output 1:" (complete -C'TestExclusive -Q') echo "Expect no output 1:" (complete -C'TestExclusive -Q')
echo "Expect no output 2:" (complete -C'TestExclusive -W') echo "Expect no output 2:" (complete -C'TestExclusive -W')
# Test for optional arguments, like cp's --backup
complete -c TestOptionalArgument -l backup -f -a 'none all simple'
echo "Expect --backup --backup=:" (complete -C'TestOptionalArgument -' | sort | string join ' ')
echo "Expect --backup=all --backup=none --backup=simple:" (complete -C'TestOptionalArgument --backup=' | sort | string join ' ')
# Test that directory completions work correctly # Test that directory completions work correctly
if begin; rm -rf test6.tmp.dir; and mkdir test6.tmp.dir; end if begin; rm -rf test6.tmp.dir; and mkdir test6.tmp.dir; end
pushd test6.tmp.dir pushd test6.tmp.dir

View file

@ -38,6 +38,8 @@ Expect -A -Q -W: -A -Q -W
Expect -AQ -AW: -AQ -AW Expect -AQ -AW: -AQ -AW
Expect no output 1: Expect no output 1:
Expect no output 2: Expect no output 2:
Expect --backup --backup=: --backup --backup=
Expect --backup=all --backup=none --backup=simple: --backup=all --backup=none --backup=simple
implicit cd complete works implicit cd complete works
no implicit cd complete after 'command' no implicit cd complete after 'command'
PATH does not cause incorrect implicit cd PATH does not cause incorrect implicit cd