diff options
author | Freddy Vulto <fvulto@gmail.com> | 2010-02-05 08:45:44 +0100 |
---|---|---|
committer | Freddy Vulto <fvulto@gmail.com> | 2010-02-05 08:45:44 +0100 |
commit | 9b9bbab1ff9dae7f0b90f33a2c157a4e82db3cc9 (patch) | |
tree | 4afe19f64abea4e1eb9626681e59ac121c0475a4 | |
parent | 6663709d7679cfbc770665dc01175ac65b6f5c6f (diff) | |
download | bash-completion-9b9bbab1ff9dae7f0b90f33a2c157a4e82db3cc9.tar.gz |
(testsuite) Fix ssh test
Fix ssh test "First argument shouldn't complete with commands" if one
has hosts starting with "bas" in known hosts. (Alioth #312292)
-rw-r--r-- | test/lib/completions/ssh.exp | 21 | ||||
-rw-r--r-- | test/lib/library.exp | 6 |
2 files changed, 8 insertions, 19 deletions
diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp index c3341294..2bec70c1 100644 --- a/test/lib/completions/ssh.exp +++ b/test/lib/completions/ssh.exp @@ -52,30 +52,17 @@ sync_after_int set test "First argument shouldn't complete with commands" -# NOTE: This test assumes the machine running this test has a command "bash" -# but no host named "bash" ... +# NOTE: This test assumes there's a command "bash" and no host named "bash" set cmd "ssh bas" -send "$cmd\t" -expect -ex "$cmd" -expect { - -timeout 1 - # In case multiple commands `bas*' - besides `bash' - are completed - -re "^\r\n.*bash.*\r\n/@$cmd$" { fail "$test" } - # In case the single command `bash' is completed - -re "h $" { fail "$test" } - # In case the hostname `bash_completion' is completed. - # See `scp' tests in `lib/completions/scp.exp' - -re "h_completion $" { pass "$test" } - -re ".+" { unresolved "$test" } - timeout { pass "$test" } -}; # expect +assert_complete [get_known_hosts "bas"] $cmd $test sync_after_int set test "First argument should complete partial hostname" -assert_complete_partial [get_hosts] ssh "" $test /@ 20 [list "ltrim_colon_completions"] +assert_complete_partial [get_hosts] ssh "" $test /@ 20 \ + [list "ltrim_colon_completions"] sync_after_int diff --git a/test/lib/library.exp b/test/lib/library.exp index 60062ccd..cb0b9c2a 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -462,10 +462,12 @@ proc bash_sort {items} { # Get 'known' hostnames. Looks also in ssh's 'known_hosts' files. +# @param string cword (optional) Word, hosts should start with. # @return list Hostnames # @see get_hosts() -proc get_known_hosts {} { - assert_bash_exec {_known_hosts_real ''; echo_array COMPREPLY} {} /@ result +proc get_known_hosts {{cword ''}} { + assert_bash_exec "_known_hosts_real '$cword'; echo_array COMPREPLY" \ + {} /@ result return $result }; # get_known_hosts() |