diff options
Diffstat (limited to 'test/lib/completions/xhost.exp')
-rw-r--r-- | test/lib/completions/xhost.exp | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp index aeceadb6..82e2e9c6 100644 --- a/test/lib/completions/xhost.exp +++ b/test/lib/completions/xhost.exp @@ -1,24 +1,19 @@ proc setup {} { assert_bash_exec {HOME=$TESTDIR} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} 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 -}; # foreach -assert_complete $hosts "xhost " $test +assert_complete [get_hosts] "xhost " $test sync_after_int @@ -28,13 +23,13 @@ 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"} { lappend hosts $h - }; # if -}; # foreach + } +} assert_complete $hosts "xhost $char" $test @@ -44,9 +39,9 @@ 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" -}; # foreach +} assert_complete $hosts "xhost \+" $test @@ -56,13 +51,13 @@ 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"} { lappend hosts "+$h" - }; # if -}; # foreach + } +} assert_complete $hosts "xhost +$char" @@ -72,9 +67,9 @@ 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" -}; # foreach +} assert_complete $hosts "xhost -" $test @@ -84,13 +79,13 @@ 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"} { lappend hosts "-$h" - }; # if -}; # foreach + } +} assert_complete $hosts "xhost -$char" $test |