[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 362090a16041c94d69a8d58f41565e0d7fe89538

Freddy Vulto fvulto at gmail.com
Fri Jun 19 10:35:25 UTC 2009


The following commit has been merged in the master branch:
commit 362090a16041c94d69a8d58f41565e0d7fe89538
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Fri Jun 19 12:33:50 2009 +0200

    Updated test _known_hosts_real.
    Added hosts retrieved by avahi-browse.

diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp
index 4452e3a..7959340 100644
--- a/test/unit/_known_hosts_real.exp
+++ b/test/unit/_known_hosts_real.exp
@@ -8,15 +8,21 @@ proc teardown {} {
 }; # teardown()
 
 
-setup
+proc get_hosts {} {
+    set hosts [exec bash -c "compgen -A hostname"]
+    lappend hosts [exec bash -c {
+        type avahi-browse >&/dev/null && 
+            avahi-browse -kcpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u
+    }]
+    return $hosts
+}; # get_hosts()
 
 
-set test "Hosts should be put in COMPREPLY"
+setup
 
-    # Build string list of hostnames, separated by regexp whitespace marker (\s+).
-    # Example string: host1\s+host2\s+host3
 
-set hosts [exec bash -c "compgen -A hostname"]
+set test "Hosts should be put in COMPREPLY"
+set hosts [get_hosts]
     # Hosts `gee' and `hus' are defined in ./fixtures/_known_hosts_real/config
     # Hosts `doo' and `ike' are defined in ./fixtures/_known_hosts_real/known_hosts
 lappend hosts doo gee hus ike
@@ -37,9 +43,7 @@ sync_after_int
 
 
 set test "Config file containing space should work"
-    # Build string list of hostnames, separated by regexp whitespace marker (\s+).
-    # Example string: host1\s+host2\s+host3
-set hosts [exec bash -c "compgen -A hostname"]
+set hosts [get_hosts]
     # Hosts `gee' and `hus' are defined in ./fixtures/_known_hosts_real/spaced  conf
     # Hosts `doo' and `ike' are defined in ./fixtures/_known_hosts_real/known_hosts
     # Host `two' is defined in ./fixtures/_known_hosts_real/known_hosts2
@@ -47,7 +51,7 @@ lappend hosts gee hus doo ike two
 set hosts [lsort -ascii $hosts]
 set hosts [join $hosts "\\s+"]
     # Call _known_hosts
-set cmd {_known_hosts -aF 'fixtures/_known_hosts_real/spaced  conf'; echo_array COMPREPLY}
+set cmd {_known_hosts_real -aF 'fixtures/_known_hosts_real/spaced  conf'; echo_array COMPREPLY}
 send "$cmd\r"
 expect -ex "$cmd\r\n"
 expect {

-- 
bash-completion



More information about the Bash-completion-commits mailing list