diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/completion/javaws.exp | 1 | ||||
-rw-r--r-- | test/lib/completions/javaws.exp | 20 | ||||
-rw-r--r-- | test/lib/completions/xhost.exp | 17 | ||||
-rw-r--r-- | test/lib/library.exp | 2 |
4 files changed, 28 insertions, 12 deletions
diff --git a/test/completion/javaws.exp b/test/completion/javaws.exp new file mode 100644 index 00000000..c1c6b106 --- /dev/null +++ b/test/completion/javaws.exp @@ -0,0 +1 @@ +assert_source_completions javaws diff --git a/test/lib/completions/javaws.exp b/test/lib/completions/javaws.exp new file mode 100644 index 00000000..cb29c65a --- /dev/null +++ b/test/lib/completions/javaws.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "javaws " + + +sync_after_int + + +teardown 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"} { diff --git a/test/lib/library.exp b/test/lib/library.exp index 61b3f409..491da212 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -636,7 +636,7 @@ proc get_known_hosts {{cword ''}} { # @return list Hostnames # @see get_known_hosts() proc get_hosts {} { - set hosts [exec bash -c "compgen -A hostname"] + set hosts [exec bash -c "compgen -A hostname | sort -u"] # NOTE: Circumventing var `avahi_hosts' and appending directly to `hosts' # causes an empty element to be inserted in `hosts'. # -- FVu, Fri Jul 17 23:11:46 CEST 2009 |