summaryrefslogtreecommitdiff
path: root/test/lib/completions_to_review/ifup.exp
blob: 69918aeb1756b0c3741c08da513fbdcaf46db981 (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
42
43
44
proc setup {} {
}; # setup()


proc teardown {} {
}; # teardown()


setup


set test "Tab should show completions"
    # Try completion
set cmd "ifup "
send "$cmd\t"
expect {
    -re "^$cmd.*\r\n/@$cmd$" { pass "$test" }
    -re /@ { unresolved "$test at prompt" }
    -re eof { unresolved "eof" }
}; # expect


sync_after_int


set test "Argument should complete"
    # Set test function for _configured_interfaces()
set cmd "_configured_interfaces() { COMPREPLY=( foo bar ); }"
send "$cmd\r"
expect -ex "$cmd\r\n/@"
    # Try completion
set cmd "ifup f"
send "$cmd\t"
expect {
    -re "^${cmd}oo\\s*$" { pass "$test" }
    -re /@ { unresolved "$test at prompt" }
    -re eof { unresolved "eof" }
}; # expect


sync_after_int


teardown