This way it's clearer to users that an argument is expected. It's
likely that this commit does not catch all such cases, but it should
do it for most of the affected commands I have installed.
_known_hosts_real tests were failing after commit 81794a9:
FAIL: Hosts should be put in COMPREPLY
FAIL: Hosts should have username prefix and colon suffix
This is because tcl's get_hosts() is now doing a unique sort, but bash
_known_hosts_real() IS returning duplicates relying on bash's compgen/complete
to remove the duplicates). Fixed by calling _get_hosts -unsorted.
Commit 8227e76 was failing on these `chown' tests in bash-4.1:
FAIL: Check preserve special chars in funky\ user:Debia<TAB>
FAIL: Check preserve special chars in funky\.user:Debia<TAB>
FAIL: Check preserve special chars in fu\ nky.user:Debia<TAB>
FAIL: Check preserve special chars in f\ o\ o\.\bar:Debia<TAB>
FAIL: Check preserve special chars in foo\_b\ a\.r\ :Debia<TAB>
because a removal pattern is expanded:
$ a=\\b
$ w=\\
$ echo ${a#$w} # Doesn't work
\b
$ echo ${a#"$w"} # Ok
b
Prohibit word creation of characters if they're excluded from
$COMP_WORDBREAKS. For example, with ':' included in $COMP_WORDBREAKS,
'a b:' should split to 'b' and ':'. With ':' excluded from
$COMP_WORDBREAKS, 'a b:' should split to 'b:', NOT 'b' and ':'.
Also made `match_items()' more strict about matching
space/newline/prompt after the last item.
Added options to match_items():
- end-newline
- end-prompt
- end-space
and transferred them to other functions.
Function `assert_complete()' now has a `-nospace' option to explicitly
disallow a space after a completion...
Function `assert_bash_list()' now expects a single item to be followed
by a newline.
File locations are prefixed with `$::srcdir' so that `make distcheck' can
execute the test suite using a relative path.
The current working directory is removed from the test-suite-bash-prompt.
Furthermore, no more dynamic creation of files in dir $::srcdir/fixtures since
this dir is read-only during `make distcheck'. Instead create dynamic files in
$TESTDIR/tmp
The test suite uses these "directory" variables
tcl bash description
------------ ----------- ------------------------------------
$::srcdir $SRCDIR where `fixtures' reside, relative
$::srcdirabs $SRCDIRABS where `fixtures' reside, absolute
$::TESTDIR $TESTDIR where `runtest' is invoked, absolute
Steps to reproduce the problem:
$ LANG=POSIX ./run unit/_parse_help.exp
...
Running ./unit/_parse_help.exp ...
FAIL: short + long
FAIL: short + long, slash separated
Cause:
When comparing list items, `assert_bash_list()' expects the real list to be
sorted, whereas the output of `_parse_help' is unsorted.
These particular two tests were failing because they suffered the
following LANG-dependant sort-difference:
$ cat t.txt
-m
--n
$ LANG=en_US.UTF-8 sort t.txt
-m
--n
$ LANG=POSIX sort t.txt
--n
-m
Solution:
Made to default for `assert_bash_list' more-intuitive: unsorted, and added an
option `-sort' to explicitly enable sorting.
I felt uncomfortable adding yet another optional argument, so I seized this
opportunity to move subsequent optional arguments to single optional arguments.
E.g.:
assert_bash_list {expected cmd {test ""} {prompt /@} {size 20}} {
has now become:
# ...
# @param list $args Options:
# -nosort Compare list unsorted. Default is sorted
# -prompt Bash prompt. Default is `/@'
# -chunk-size N Compare list N items at a time. Default
# is 20.
assert_bash_list {expected cmd test {args {}}
(and the `test' argument has become mandatory).
This provides a bit of case insensivity to file extension matching,
allowing for example _filedir foo to match both *.foo and *.FOO. Note
that this is not real case insensivity; mixed case extensions like
*.FOO.gz are not matched by _filedir foo.gz so those need to be
handled like before this change.
This fixes tilde completion when doing for instance `ls ~<TAB>'. See
also: Alioth #312613.
Added _tilde() helper function.
Contrary to _expand() and __expand_tilde_by_ref(), _tilde() also leaves the
tilde (~) intact. Replacement of the tilde has been a complaint in other
bugreports, especially since plain bash completion (without bash-completion
installed) doesn't expand the tilde when doing a `ls ~<TAB>'.
To run the tests:
./run completion/ls.exp
./run unit/_tilde.exp