summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-02-05 12:24:49 +0200
committerVille Skyttä <ville.skytta@iki.fi>2011-02-05 12:24:49 +0200
commit80312be9afd77307dd8eecf4bc1a2408949ed58e (patch)
tree4715c82d62b5d77211529cf5e3ea2144720c6901
parent56c12d5570699ecd4059379b64cc630832691ebe (diff)
downloadbash-completion-80312be9afd77307dd8eecf4bc1a2408949ed58e.tar.gz
(testsuite) Use get_hosts() in xhost tests.
-rw-r--r--test/lib/completions/xhost.exp17
1 files changed, 6 insertions, 11 deletions
diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp
index d4098ade..82e2e9c6 100644
--- a/test/lib/completions/xhost.exp
+++ b/test/lib/completions/xhost.exp
@@ -13,12 +13,7 @@ setup
set test "Tab should complete hostnames"
- # Build string list of hostnames
-set hosts {}
-foreach h [exec bash -c "compgen -A hostname"] {
- lappend hosts $h
-}
-assert_complete $hosts "xhost " $test
+assert_complete [get_hosts] "xhost " $test
sync_after_int
@@ -28,7 +23,7 @@ set test "Tab should complete partial hostname"
# Build string list of hostnames, starting with the character of the first hostname
set hosts {}
set char ""
-foreach h [exec bash -c "compgen -A hostname"] {
+foreach h [get_hosts] {
if {$char == ""} {set char [string range $h 0 0]}
# Only append hostname if starting with $char
if {[string range $h 0 0] == "$char"} {
@@ -44,7 +39,7 @@ sync_after_int
set test "Tab should complete hostnames prefixed with +"
# Build string list of hostnames, prefixed with plus (+)
set hosts {}
-foreach h [exec bash -c "compgen -A hostname"] {
+foreach h [get_hosts] {
lappend hosts "+$h"
}
assert_complete $hosts "xhost \+" $test
@@ -56,7 +51,7 @@ sync_after_int
set test "Tab should complete partial hostname prefixed with +"
# Build string list of hostnames, starting with character of first host.
set hosts {}
-foreach h [exec bash -c "compgen -A hostname"] {
+foreach h [get_hosts] {
if {$char == ""} {set char [string range $h 0 0]}
# Only append hostname if starting with $char
if {[string range $h 0 0] == "$char"} {
@@ -72,7 +67,7 @@ sync_after_int
set test "Tab should complete hostnames prefixed with -"
# Build string list of hostnames, prefix with minus (-)
set hosts {}
-foreach h [exec bash -c "compgen -A hostname"] {
+foreach h [get_hosts] {
lappend hosts "-$h"
}
assert_complete $hosts "xhost -" $test
@@ -84,7 +79,7 @@ sync_after_int
set test "Tab should complete partial hostname prefixed with -"
# Build list of hostnames, starting with character of first host
set hosts {}
-foreach h [exec bash -c "compgen -A hostname"] {
+foreach h [get_hosts] {
if {$char == ""} {set char [string range $h 0 0]}
# Only append hostname if starting with $char
if {[string range $h 0 0] == "$char"} {