From dce9453d25ad06029d4d11d75ae5e2a42a6d2215 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 21 Dec 2016 15:46:32 -0800 Subject: [PATCH] Add a new completion test for optional arguments --- tests/test6.in | 5 +++++ tests/test6.out | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tests/test6.in b/tests/test6.in index dffe5e1a9..0ea772bb9 100644 --- a/tests/test6.in +++ b/tests/test6.in @@ -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 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 if begin; rm -rf test6.tmp.dir; and mkdir test6.tmp.dir; end pushd test6.tmp.dir diff --git a/tests/test6.out b/tests/test6.out index 81c2684a7..6e21926d2 100644 --- a/tests/test6.out +++ b/tests/test6.out @@ -38,6 +38,8 @@ Expect -A -Q -W: -A -Q -W Expect -AQ -AW: -AQ -AW Expect no output 1: 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 no implicit cd complete after 'command' PATH does not cause incorrect implicit cd