- Added code comments to _get_cword, __get_cword3 & __get_cword4
- (testsuite) Added tests for _get_cword
- (testsuite) Bugfixes assert_bash_exec() && match_items()
Bash-4 splits COMP_WORDS using characters from COMP_WORDBREAKS, but has
a bug where quoted words are also splitted, see:
http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
__get_cword3 is used for bash-2/3 and __get_cword4 is used for bash-4.
__get_cword4 handles well temporarily disabling of COMP_WORDBREAK
characters, but fails quoted words (a 'b c) and subshells (a $(b c).
See the expected failures when running the automated tests.
__get_cword3 does a better job of returning quoted words.
To run the automated tests on bash-3/4:
$ ./runUnit _get_cword.exp [--tool_exec <path to bash-3/4 binary>]
Using option `--tool_exec' you can now specify which bash binary you
want to use:
$ ./runUnit --tool_exec /opt/bash-4/bin/bash
$ ./runCompletion --tool_exec /opt/bash-4/bin/bash
If not specified, current `bash' as found in the tcl path (/bin/bash)
will be used.
This reverts commit 584bc520dfbc0e6a7e949b885bb9b949f99a1ff9.
This commit broke "general" man completion, trying to give "pages"
(from man-pages(7)) after $ man |. This would've been ok only if
$ man man | (man man pages indeed works). Trying to look for a fix :)
assert_env_unmodified() now calls `diff_env' with `LAST-ARG' as the last
argument. Now $_ becomes `LAST_ARG' and $_ doesn't interfere with the
diff anymore as it would if $_ was the sed script.
Added line continuation (\) to bash script of `get_hosts_avahi()'.
Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS
whenever a shopt setting is sourced or eval'ed. Disabling 'history'
makes it not show in tests "Environment should not be modified"
for bash < 3.2.41.
Added helper function `is_bash_version_minimal()' to
test/lib/library.sh.
- Fix get_hosts_avahi() if avahi-browse not available
- Removed test "Tab should complete hostnames" from finger since it's
returning (for the moment) undetectable ip-addresses from known_hosts
files. Furthermore the next test "Tab should complete partial
hostname" is testing the same.
`_get_cword' is reverted to before commit f6497298.
This fixes unittest:
"a b:c| with WORDBREAKS -= : should return b:c"
(| = cursor position)
notably by restoring passing an argument to _get_cword to omit
characters from $COMP_WORDBREAKS.
At the end of `get_cword', `echo "$cur"' has been changed to `printf
"%s" "$cur"'. This fixes unittest:
"a -n| should return -n"
(| = cursor position)
These are the tests (| = cursor position):
1. a b| should return b
2. a | should return nothing
3. a b|c should return b
4. a b\ c| should return b\ c
5. a 'b c| should return 'b c
6. a "b c| should return "b c
7. a b:c| should return c
8. a b:c| with WORDBREAKS -= : should return b:c
9. a -n| should return -n
Tests 5 & 6 yield "expected failures", see bugreport:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474094 . At a first glance
this bugreport contains useful ideas, so anyone willing to try to make tests 5 &
6 pass, be sure to have a look there first.
To run the automated tests:
$ cd test && ./runUnit _get_cword.exp
This reverts commit 11d4d978876ceb58eaec5dcfd82fae7b9699acfd.
Avoiding breaking completion for the sudo'd command isn't as
straightforward as I thought.
See also bugreport Alioth #311614.
Added tests for the awk script processing IP numbers. To run the tests:
cd test
./runUnit _known_hosts_real.exp
./runCompletion ssh.exp scp.exp sftp.exp
Quote sed output ("\1") retrieving "GlobalKnownHostsFile/UserKnownHostsFile" to
prevent bash globbing of special characters, e.g. '*'.
Added unit test "Config file containing star (*) should work".
Added test library function `assert_bash_list()'.
To run unit tests:
cd test && ./runUnit _known_hosts_real.exp