fish-shell/tests
Johannes Altmanninger eae1683033 Completion: complete argument to last of a group of short options
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes #332
2019-10-16 11:30:50 +02:00
..
checks Completion: complete argument to last of a group of short options 2019-10-16 11:30:50 +02:00
test_functions Don't resolve symlinks with cd 2018-10-06 17:03:18 -07:00
.gitignore tweak gitignore rules for *tests* directory 2017-02-20 20:29:43 -08:00
__fish_complete_directories.err improve __fish_complete_directories function 2017-04-11 13:45:53 -07:00
__fish_complete_directories.in Fix __fish_complete_suffix behavior per __fish_complete_directories test 2018-05-20 14:35:52 -05:00
__fish_complete_directories.out Port realpath tests to littlecheck 2019-07-02 23:05:50 +02:00
__fish_contains_opt.err another __fish_sgrep replacement 2017-04-13 23:14:36 -07:00
__fish_contains_opt.in another __fish_sgrep replacement 2017-04-13 23:14:36 -07:00
__fish_contains_opt.out another __fish_sgrep replacement 2017-04-13 23:14:36 -07:00
__fish_not_contain_opt.err fix typo in unit test 2017-06-09 13:35:00 -07:00
__fish_not_contain_opt.in another __fish_sgrep replacement 2017-04-13 23:14:36 -07:00
__fish_not_contain_opt.out another __fish_sgrep replacement 2017-04-13 23:14:36 -07:00
bind.expect Allow binding nul (zero byte) 2019-09-14 16:37:57 -07:00
bind.expect.err Reset fish_bind_mode when changing fish_key_bindings 2014-09-18 15:46:17 -07:00
bind.expect.out Allow binding nul (zero byte) 2019-09-14 16:37:57 -07:00
cd.err Add a test that verifies cd handling in pipes 2019-06-09 16:08:00 -07:00
cd.in cd: Add test for changing to a dir starting with a - char 2019-10-10 18:06:11 +02:00
cd.out Add a test that verifies cd handling in pipes 2019-06-09 16:08:00 -07:00
commandline.expect Stop unescaping strings with commandline -b 2016-01-10 17:25:22 -08:00
commandline.expect.err Stop unescaping strings with commandline -b 2016-01-10 17:25:22 -08:00
commandline.expect.out Stop unescaping strings with commandline -b 2016-01-10 17:25:22 -08:00
empty.err Add tests for evaluaton of empty blocks and functions 2019-04-13 17:21:13 -05:00
empty.in Add tests for evaluaton of empty blocks and functions 2019-04-13 17:21:13 -05:00
empty.out Add tests for evaluaton of empty blocks and functions 2019-04-13 17:21:13 -05:00
exit.expect Correct the exit expect test 2019-09-14 12:46:57 -07:00
exit.expect.err correct handling of SIGHUP by interactive fish 2017-01-24 15:24:13 -08:00
exit.expect.out correct handling of SIGHUP by interactive fish 2017-01-24 15:24:13 -08:00
expansion.err Fix caret position of invalid expansion in command position 2019-10-06 13:43:05 -07:00
expansion.in Fix caret position of invalid expansion in command position 2019-10-06 13:43:05 -07:00
expansion.out Test expansion syntax errors. 2019-04-11 21:59:23 -07:00
fish_opt.err use new logmsg and set --show in tests 2017-08-04 12:01:16 -07:00
fish_opt.in use new logmsg and set --show in tests 2017-08-04 12:01:16 -07:00
fish_opt.out use new logmsg and set --show in tests 2017-08-04 12:01:16 -07:00
fkr.expect Allow binding nul (zero byte) 2019-09-14 16:37:57 -07:00
fkr.expect.err don't allow f-k-r to run if stdin/stdout not a tty 2016-06-26 21:51:00 -07:00
fkr.expect.out f-k-r should use the user's locale 2016-06-30 20:49:56 -07:00
function.err functions -q: Return false without an argument 2019-02-01 18:34:45 +01:00
function.in functions -q: Return false without an argument 2019-02-01 18:34:45 +01:00
function.out functions -q: Return false without an argument 2019-02-01 18:34:45 +01:00
functions.err implement means to learn about a functions source 2017-01-20 21:48:41 -08:00
functions.in builtins: Use standard builtin.h error macros more 2019-09-17 22:04:33 -07:00
functions.out Add test for erasing unloaded functions 2019-06-22 18:20:54 +02:00
gen_output.fish Remove caret redirection 2018-04-01 13:48:21 -07:00
generic.expect Move bare source test to expect 2018-12-11 18:23:37 +01:00
generic.expect.err Allow U+F8FF to be typed 2014-09-21 21:03:44 -07:00
generic.expect.out Allow U+F8FF to be typed 2014-09-21 21:03:44 -07:00
histfile.expect Make history tests more robust 2019-06-28 11:16:27 -07:00
histfile.expect.err Make the history session configurable 2017-06-30 17:13:02 -07:00
histfile.expect.out Make the history session configurable 2017-06-30 17:13:02 -07:00
histfile.expect.status Make the history session configurable 2017-06-30 17:13:02 -07:00
history.err modify read to require at least one var 2017-07-20 13:07:30 -07:00
history.expect history expect tests: fix the tests. 2018-11-20 05:26:54 -08:00
history.expect.err correct handling of history args 2016-07-20 21:18:48 -07:00
history.expect.out mplement history search glob searches 2017-09-15 13:43:45 -07:00
history.in update history to use argparse 2017-07-16 15:13:39 -07:00
history.out make it hard to use history command incorrectly 2016-09-09 19:23:06 -07:00
history_sample_bash improve bash history importing 2017-05-20 21:03:31 -07:00
history_sample_corrupt1 Improve history robustness against corrupt files 2014-07-29 14:42:03 -07:00
history_sample_fish_1_x Support for importing fish 1.x's history and format, and also bash 2012-06-15 16:24:05 -07:00
history_sample_fish_2_0 Support for importing fish 1.x's history and format, and also bash 2012-06-15 16:24:05 -07:00
indent.err Implement tests for fish_indent 2014-12-23 15:46:47 -08:00
indent.in Fix fish_indent tests 2019-05-24 17:00:56 -07:00
indent.out Fix fish_indent tests 2019-05-24 17:00:56 -07:00
interactive.config remove some uses of $IFS 2017-07-25 12:44:26 -07:00
interactive.expect.rc Add pipeline tests 2019-04-07 09:20:32 -07:00
interactive.fish tests: fix date --version printing junk, update interactive.fish 2019-09-19 15:06:51 -07:00
jobs.err split builtin bg into its own module 2017-06-16 21:01:56 -07:00
jobs.in jobs: return success when a job is found via --last 2019-09-14 13:01:36 -05:00
jobs.out jobs: return success when a job is found via --last 2019-09-14 13:01:36 -05:00
line-continuation.err fix handling of line continuation in keywords 2016-04-08 21:05:46 -07:00
line-continuation.in fix handling of line continuation in keywords 2016-04-08 21:05:46 -07:00
line-continuation.out fix handling of line continuation in keywords 2016-04-08 21:05:46 -07:00
locale.err remove unset vars from the environment 2016-06-15 22:10:11 -07:00
locale.in remove dependency on xxd 2017-01-31 22:10:53 -08:00
locale.out remove dependency on xxd 2017-01-31 22:10:53 -08:00
parameter_expansion.err Add tests for new parameter expansion features 2018-03-12 07:04:05 -05:00
parameter_expansion.in Only do brace expansion if they contain a variable or "," 2019-05-19 18:23:27 +02:00
parameter_expansion.out Only do brace expansion if they contain a variable or "," 2019-05-19 18:23:27 +02:00
pipeline.expect Reduce loop count of pipeline test 2019-04-07 15:00:13 -07:00
pipeline.expect.err Add pipeline tests 2019-04-07 09:20:32 -07:00
pipeline.expect.out Add pipeline tests 2019-04-07 09:20:32 -07:00
pipestatus.err add $pipestatus support 2019-02-24 21:46:52 -08:00
pipestatus.expect add $pipestatus support 2019-02-24 21:46:52 -08:00
pipestatus.expect.err add $pipestatus support 2019-02-24 21:46:52 -08:00
pipestatus.expect.out add $pipestatus support 2019-02-24 21:46:52 -08:00
pipestatus.in add $pipestatus support 2019-02-24 21:46:52 -08:00
pipestatus.out add $pipestatus support 2019-02-24 21:46:52 -08:00
psub.err return to psub --file being the default 2017-07-17 14:33:51 -07:00
psub.in tests/psub: Don't use grep -o and diff -q 2019-01-03 11:05:03 +01:00
psub.out return to psub --file being the default 2017-07-17 14:33:51 -07:00
random.err builtins: Use standard builtin.h error macros more 2019-09-17 22:04:33 -07:00
random.in implement an improved random command 2016-12-20 16:46:33 -08:00
random.out implement an improved random command 2016-12-20 16:46:33 -08:00
read.err Fix unit tests for read to stdout behavior 2017-10-10 08:34:50 +02:00
read.expect tests/read.expect: Skip /dev/stdin if it doesn't exist 2019-01-01 14:52:26 +01:00
read.expect.err Add a test harness for interactive behavior 2014-09-07 23:56:59 -07:00
read.expect.out Fix read tests to reflect updated arguments 2018-03-09 12:19:20 -06:00
read.in read: add --list as synonym for --array 2019-08-22 21:24:17 +08:00
read.out Correct read behavior for unset values and update tests accordingly 2018-04-17 21:34:22 -05:00
set.err Test setting readonly variables 2018-11-18 22:33:02 +01:00
set.in Test setting readonly variables 2018-11-18 22:33:02 +01:00
set.out Test setting readonly variables 2018-11-18 22:33:02 +01:00
signals.expect Fix $pid -> $fish_pid in signals.expect 2018-03-24 12:15:58 -05:00
signals.expect.err correct handling of SIGHUP by interactive fish 2017-01-24 15:24:13 -08:00
signals.expect.out correct handling of SIGHUP by interactive fish 2017-01-24 15:24:13 -08:00
status.err Test: validate $status is preserved on calling into a function 2019-04-13 17:21:13 -05:00
status.in Test: validate $status is preserved on calling into a function 2019-04-13 17:21:13 -05:00
status.out tests, CHANGELOG: regex-easyesc 2019-08-13 22:56:31 -07:00
test.fish Add a simple test for SIGINT out of loops 2019-10-15 22:33:53 -07:00
test1.err Only do brace expansion if they contain a variable or "," 2019-05-19 18:23:27 +02:00
test1.in Only do brace expansion if they contain a variable or "," 2019-05-19 18:23:27 +02:00
test1.out Only do brace expansion if they contain a variable or "," 2019-05-19 18:23:27 +02:00
test2.err Add subdirectories 2005-09-20 23:31:55 +10:00
test2.in remove trialing spaces #2 2010-09-18 10:18:26 +08:00
test2.out Add subdirectories 2005-09-20 23:31:55 +10:00
test4.err use new logmsg and set --show in tests 2017-08-04 13:36:51 -07:00
test4.in use new logmsg and set --show in tests 2017-08-04 13:36:51 -07:00
test4.out builtin_test: don't exit 1 for eval errors, add tests for big args 2018-12-15 22:05:19 -08:00
test5.err Revert "Update tests" 2018-11-28 06:27:21 -08:00
test5.in Remove support for the ? wildcard 2018-03-31 16:54:50 -07:00
test5.out make testing on local servers hermetic 2016-02-25 17:16:36 -08:00
test6.err allow complete -d '' 2016-11-17 14:53:50 -08:00
test6.in Remove caret redirection 2018-04-01 13:48:21 -07:00
test6.out Add a new completion test for optional arguments 2016-12-21 15:46:46 -08:00
test7.err Add a test case for switch error code (issue #161) 2012-06-24 13:43:44 -07:00
test7.in Update tests for new type behavior 2014-07-13 19:11:29 -07:00
test7.out Finish rewriting detect_errors to use new parser. All tests now pass (!) 2013-12-12 18:18:07 -08:00
test8.err Execute the conditions of if and while statements outside of their block 2018-03-31 14:57:24 -07:00
test8.in Execute the conditions of if and while statements outside of their block 2018-03-31 14:57:24 -07:00
test8.out Execute the conditions of if and while statements outside of their block 2018-03-31 14:57:24 -07:00
test9.err Error message prefix: Prefix the message, not the context 2017-04-11 20:00:29 -07:00
test9.in tests/test9: Guard locale 2019-01-01 14:52:26 +01:00
test9.out return to psub --file being the default 2017-07-17 14:33:51 -07:00
test_builtinbuiltin.err Add builtin -q 2019-02-12 20:34:19 +01:00
test_builtinbuiltin.in Add builtin -q 2019-02-12 20:34:19 +01:00
test_builtinbuiltin.out Add builtin -q 2019-02-12 20:34:19 +01:00
test_cmdsub.err Remove "called on standard input" message 2019-03-26 17:38:41 +01:00
test_cmdsub.in Rename FISH_READ_BYTE_LIMIT to fish_read_limit 2017-10-14 08:33:02 -07:00
test_cmdsub.out fix set --show of semi-empty var 2017-08-16 13:39:48 -07:00
test_exec_fail.err src/exec: fix assertion on failed exec redirection 2019-02-12 20:52:03 -08:00
test_exec_fail.in src/exec: fix assertion on failed exec redirection 2019-02-12 20:52:03 -08:00
test_exec_fail.out src/exec: fix assertion on failed exec redirection 2019-02-12 20:52:03 -08:00
test_exec_fail.status src/exec: fix assertion on failed exec redirection 2019-02-12 20:52:03 -08:00
test_util.fish Check for {g,}date existance before trying --version 2019-09-21 18:42:55 -07:00
top.out Don't leave is_block in bad state after bad redirection 2014-09-30 17:06:56 -07:00
umask.err fix umask handling of symbolic modes 2017-03-28 16:28:24 -07:00
umask.in fix umask handling of symbolic modes 2017-03-28 16:28:24 -07:00
umask.out fix umask handling of symbolic modes 2017-03-28 16:28:24 -07:00
vars_as_commands.err Revert "Update tests" 2018-11-28 06:27:21 -08:00
vars_as_commands.in Fix builtin $var expansion 2019-02-10 14:45:03 -08:00
vars_as_commands.out Fix builtin $var expansion 2019-02-10 14:45:03 -08:00
wait.expect Speed up wait.expect test 2018-12-31 19:36:08 -06:00
wait.expect.err add wait command 2017-11-16 10:48:21 -08:00
wait.expect.out add wait command 2017-11-16 10:48:21 -08:00
while.err Make while loops evaluate to the last executed command status 2019-01-20 16:37:20 -08:00
while.in Make while loops evaluate to the last executed command status 2019-01-20 16:37:20 -08:00
while.out Make while loops evaluate to the last executed command status 2019-01-20 16:37:20 -08:00
zero_based_array.err Revert "Update tests" 2018-11-28 06:27:21 -08:00
zero_based_array.in Correct misdetection of [001] as literal zero index 2018-10-15 14:11:37 -05:00
zero_based_array.out Correct misdetection of [001] as literal zero index 2018-10-15 14:11:37 -05:00