blob: c055f3541917b56e0a4ba103a3d5538cfffbbdd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
sync_after_int
set test "Tab should complete partial hostname"
# Build string list of hostnames, starting with the character of the first
# host, unless host starts with a COMP_WORDBREAKS character, e.g. a colon (:).
# Hosts starting with a COMP_WORDBREAKS character are left out because these
# are exceptional cases, requiring specific tests.
set hosts {}
set char ""
foreach h [get_known_hosts] {
set first [string range $h 0 0]
if {$char == "" && [string first $first $::COMP_WORDBREAKS] == -1} {set char $first}
if {$char != ""} {
# Only append unique hostnames starting with $char
if {$first == $char && [lsearch -exact $hosts "test@$h"] == -1} {
# Prefix hosts with username 'test@'
lappend hosts "test@$h"
}
}
}
assert_complete $hosts "finger test@$char" $test -expect-cmd-minus "test@$char"
sync_after_int
teardown
|