This solves the following problems:
- now one function call suffices instead of two (_get_cword; _get_pword) if
subsequent words need to be retrieved. Also more than two words can be
retrieved at once, e.g.: _get_comp_words_by_ref cur prev prev2 prev3
Also this prevents passing of `wordbreakchars' to differ in calls to
`_get_cword' and `_get_pword', e.g.: _get_comp_words_by_ref -n : cur prev
- passing by reference, no subshell call necessary anymore
- _get_pword now also takes into account the cursor position
Added testsuite proc `assert_no_output()'
Word of caution:
The passing-arguments-by-ref system in bash doesn't work if the new variable is
also declared local. For example:
t() {
local a
# ...
eval $1=b
}
a=c; t a; echo $a # Outputs "c", should be "b"
# Variable "a" is 'forbidden'
To make name collissions like this less likely to happen, but make the real
function still use readable variables, I've wrapped the `*_by_ref'
functions within an additional layer using variables prefixed with double
underscores (__). For example:
_t() {
# Readable variables can still be used here
local a
# ...
eval $1=b
}
t() {
local __a
_t __a
eval $1=\$__a
}
a=c; t a; echo $a # Outputs "b"
# Variable "__a" is 'forbidden'
Now only more obfuscated variables (starting with double prefix (__)) are
forbidden to use.
- assert_source_completions()
- is_bash_completion_installed_for()
This allows for cleaner invocation of tests in `lib/completions/'. For
example, `completion/perldoc.exp' now just contains:
assert_source_completions perldoc
Skeleton test files for a command can be generated with:
$ ./generate <command>
Make `assert_bash_type' reflect bash-side where `have perl' is checked,
and not perldoc, to determine whether `perldoc' completion should be
installed.
Many basic commands do not have long options on non-GNU systems, mark such
tests as unsupported (if the command doesn't respond to --help) instead of
failing.
Implemented with the new $failcmd parameter to assert_exec().
Improve test suite.
Thanks to Leonard Crestez (Alioth: #311396, Debian: #511788).
`assert_complete' is improved. It proved difficult to tell tcl to ignore
backslash escapes, e.g. the `\b' is no BACKSPACE but a literal `b'. The added
function `split_words_bash' should to the trick now.
Added function `assert_no_complete' which can also be reached by calling
`assert_complete' with an empty `expected' argument:
assert_complete "" qwerty
Added test suite function `get_known_hosts' which calls bash's `_known_hosts_real'.
Also the `finger' test "Tab should complete partial hostname" now skips hosts starting with character in COMP_WORDBREAKS leaving that to test for another test case.
See also: https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=312220&group_id=100114