[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 9b9bbab1ff9dae7f0b90f33a2c157a4e82db3cc9

Freddy Vulto fvulto at gmail.com
Fri Feb 5 07:47:48 UTC 2010


The following commit has been merged in the master branch:
commit 9b9bbab1ff9dae7f0b90f33a2c157a4e82db3cc9
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Fri Feb 5 08:45:44 2010 +0100

    (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)

diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp
index c334129..2bec70c 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 60062cc..cb0b9c2 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()
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list