79 Commits

Author SHA1 Message Date
Freddy Vulto
6925ad5081 Mutt fixes
- Added support for `-F configfile'.  This enables using a specially
  crafted muttrc for automated testing.
- Centralized call to _get_cword
- Used _get_pword
- Specified non-wordbreak characters to _get_cword() & _get_pword() for
  bash-4.
- Added automated tests for -f and -A
- Fixed test suite's assert_complete() (test/library.exp) to drop only
  the last element
2009-11-01 10:04:06 +01:00
Freddy Vulto
a55d311ae2 (testsuite) Moved unsetting COMPREPLY 2009-10-31 08:32:58 +01:00
Freddy Vulto
820b7c2602 (testsuite) Fix _known_hosts_real
Clear COMPREPLY after test now that _known_hosts_real is appending
instead of setting COMPREPLY.
2009-10-30 17:18:43 +01:00
Guillaume Rousse
b56a8dfaae fix conflicts 2009-10-04 19:46:01 +02:00
Guillaume Rousse
506e1cb3eb new indentation policy 2009-10-04 19:42:50 +02:00
Freddy Vulto
bb47efd9b6 (testsuite) Allow trailing space on one completion
Within `match_items', if only one completion is generated, an (optional)
trailing space is allowed, because -o nospace might not be in effect.
2009-10-04 18:18:29 +02:00
Freddy Vulto
1be84710d2 Silence completing scp/sftp/ssh -F '' on bash-4
This fixes a bug under bash-4 where completing:

   scp -F 'spaced  conf' <TAB>

causes `dequote' to yield errors:

    bash: eval: line 1: unexpected EOF while looking for matching `''
    bash: eval: line 2: syntax error: unexpected end of file

The bug occurs because of a bug in bash-4.0, where quoted words are split
unintended, see: http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html

Workaround is now to silence `dequote' in case of errors and wait for bash-4 to
be fixed...
2009-10-04 18:14:16 +02:00
Freddy Vulto
9c53f0d6e6 (testsuite) Added empty directories to git
Empty directories are ignored by git.  By putting an empty .gitignore in
the directory, the directory can be added to git.
2009-10-03 09:39:55 +02:00
Freddy Vulto
9eb0ee2851 (test suite) Added global var `bash_versinfo_0'
This variable was introduced by unit/_get_cword.exp but is now upgraded
to a global var.
2009-10-02 16:39:11 +02:00
Freddy Vulto
d2c6b1ede0 (test suite) Added test for dd
Added test "option should be suffixed with ="
This test exhibits the bug (expected failure) that `dd if<TAB>' gets completed
with `\=' instead of `='.
2009-10-02 16:13:46 +02:00
Freddy Vulto
453a55e9c8 (testsuite) Fix assert_bash_exec to match prompt
Added documentation to "Testing" chapter:
- Running tests via cron
- Specifying bash binary
2009-10-02 10:53:00 +02:00
Ville Skyttä
369980bf93 Tell *Emacs to indent comments (sh-indent-comment: t).
Also move indentation settings to end of files and expand *Emacs ones to
local variables block to avoid overflowing 80 char lines.
2009-10-01 20:54:51 +03:00
Freddy Vulto
9501c0fa90 (testsuite) Fix assert_bash_exec output parameter
Changed `out' parameter of `assert_bash_exec()' to accept also -1 and 0:

@param mixed $out  (optional) Reference to variable to hold output.
    If variable equals -1 (default) the bash command is
    expected to return no output.  If variable equals 0,
    any output from the bash command is disregarded.

This fixes the situation of commit cfcf9fa where contrib/ri was causing
invisible errors when running the test suite.
2009-09-26 11:00:02 +02:00
Freddy Vulto
b66425e8cf (testsuite) Remove test with non-portable filenames
Files containing a star (*) aren't support on FAT, thus Cygwin.
Closes Alioth #311979.
2009-09-25 20:28:00 +02:00
Freddy Vulto
f733e71e1f Split _get_cword into bash-3/4 versions
- 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>]
2009-09-20 14:11:26 +02:00
Freddy Vulto
fcf2bf91c9 (testsuite) Added `stdout' to assert_bash_exec()
Added support to assert_bash_exec() to retrieve bash output within
tcl/expect.
2009-09-20 13:07:04 +02:00
Freddy Vulto
fc3f65e6dd (testsuite) Supported specifying bash 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.
2009-09-20 12:59:08 +02:00
Freddy Vulto
046f2abc6f (testsuite) Tighten `match_items()'
An item now must match at the beginning of the line, to prevent
mismatches.
2009-09-16 23:17:56 +02:00
Freddy Vulto
171fc0e3c6 (testsuite) Added more tests for _get_cword
To run the tests:

   cd test && ./runUnit _get_cword.exp
2009-09-16 22:20:15 +02:00
Freddy Vulto
fe88919de4 (testsuite) Fix assert_env_unmodified() & get_hosts_avahi()
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()'.
2009-09-16 22:14:53 +02:00
Freddy Vulto
c6a8b856de (testsuite) set +o history for bash < 3.2.41
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.
2009-09-16 22:05:23 +02:00
Freddy Vulto
03526772fa Fixes testsuite:
- 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.
2009-09-13 18:05:58 +02:00
Freddy Vulto
5999df7fea Merge branch 'master' into fvu 2009-09-13 13:32:14 +02:00
Freddy Vulto
4467ce1725 Fix completion test for dpgk -L 2009-09-12 22:31:10 +02:00
Ville Skyttä
c31daf26ae Fix sbcl file/dirname completion (Debian: #545743). 2009-09-09 18:54:18 +03:00
Freddy Vulto
e20a4cb06e Added unit tests for _get_cword
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
2009-09-07 00:26:27 +02:00
Freddy Vulto
de585f387d Fix _known_hosts_real() to not glob awk script
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
2009-09-04 23:08:56 +02:00
Freddy Vulto
31f03cfb82 Fix for known_host files containing * character
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
2009-08-23 09:38:19 +02:00
Freddy Vulto
9af88e6bd4 Fix unit test _known_hosts_real
Test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE" now
includes hosts reported by avahi.
2009-08-18 21:28:43 +02:00
Freddy Vulto
2e87bd4c01 Added setting COMP_KNOWN_HOSTS_WITH_HOSTFILE
`_known_hosts_real' will add hosts from HOSTFILE (compgen -A hostname), unless
`COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.

To run the unit tests:

   $ cd test && ./runUnit _known_hosts_real.exp
2009-08-12 22:20:56 +02:00
Freddy Vulto
466fc03e28 Add generate script for completion tests 2009-08-11 21:07:06 +02:00
Freddy Vulto
90fc7be011 Reviewed tests v*, w*, x* & y*
Directories `test/_completion_to_review' &
'lib/completions_to_review' are now removed.
2009-08-01 09:35:24 +02:00
Freddy Vulto
85dd9cd64c Reviewed tests u* 2009-07-31 22:53:30 +02:00
Freddy Vulto
bcd33375ca Reviewed tests t* 2009-07-31 22:18:12 +02:00
Freddy Vulto
567eb37802 Reviewed tests s* 2009-07-31 12:20:51 +02:00
Freddy Vulto
6d31b15011 Fix backwards compatibility calls to _known_hosts
This mimics the old behaviour where you could reuse `_known_hosts()' as
a helper function and pass it `-a' or `-c'.
NOTE: Using `_known_hosts' as a helper function and passing options to
`_known_hosts' is deprecated: Use `_known_hosts_real' instead.
2009-07-25 09:35:03 +02:00
Freddy Vulto
ddb0571227 Reviewed tests q* & r*
Added .swp (vim backup) files to .gitignore
2009-07-24 12:33:30 +02:00
Freddy Vulto
53b1c41c16 Reviewed tests p* 2009-07-24 11:58:02 +02:00
Freddy Vulto
285136a8df Reviewed tests o* 2009-07-24 11:20:38 +02:00
Freddy Vulto
890cadbc3a Reviewed tests n* 2009-07-24 11:16:03 +02:00
Freddy Vulto
0d443835c4 Reviewed tests m* 2009-07-24 09:55:54 +02:00
Freddy Vulto
9bb02ca317 Reviewed tests l* 2009-07-20 21:13:58 +02:00
Freddy Vulto
f1f61ace51 Reviewed tests j* & k* 2009-07-19 14:48:55 +02:00
Freddy Vulto
11302d4038 Reviewed tests h* & i*
Localized `i' variable in `info' completion.
2009-07-18 16:55:23 +02:00
Freddy Vulto
c6af1bf435 Reviewed tests g*
Removed excess parenthesis from gdb completion
2009-07-18 09:43:25 +02:00
Freddy Vulto
22675a60f7 Reviewed tests f* 2009-07-17 23:15:15 +02:00
Freddy Vulto
55bc44b035 Reviewed tests e*
Fixed `assert_complete()' to remove an optional (partial) argument from
`cmd' when expecting `cmd + longestCommonPrefix'.
Added `prompt' argument to procs `assert_bash_exec()' &
`sync_after_int()'
2009-07-17 16:15:02 +02:00
Freddy Vulto
f615d17cb6 tsuite) Only test completions if installed
Some tests failed with label `failed', which is incorrect because the
completions just weren't installed.  Completions weren't installed
because the commands to complete weren't installed.
Fixed so that if commands aren't available, the tests fail with label
`unsupported'.
2009-07-16 22:51:18 +02:00
Freddy Vulto
2d905413fb (testsuite) Removed local short timeout values
The local timeout settings `-timeout 1' in some loops seemed to cause
inpredictable results, e.g. with `./runCompletion dkpg.exp' since this
test has a long list to match.  Sometimes the `spawn_id' was gone before
the `teardown' method was called.
Removing the short timeout seems to give more predictable results.
2009-07-16 22:47:44 +02:00
Freddy Vulto
acdf4ca55e (testsuite) Improve `cancel' with dummy print job
A dummy print job is now created (and removed/cancelled) when testing `cancel' completion.
To run the test:

    cd test && ./runCompletion cancel.exp
2009-07-12 21:41:56 +02:00