summaryrefslogtreecommitdiff
path: root/test/lib/completions/screen.exp
blob: 62c57362d4dd6a956cca9e1576ea66ae559c29de (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
45
46
47
48
49
50
51
52
proc setup {} {
    save_env
}; # setup()


proc teardown {} {
    assert_env_unmodified {/OLDPWD=/d}
}; # teardown()


setup


assert_complete_any "screen -"


sync_after_int


set test "-c should complete files/dirs"
set dir fixtures/shared/default
set prompt "/$dir/@"
assert_bash_exec "cd $dir" "" $prompt
set cmd "screen -c "
set expected {bar {bar bar.d} foo {foo.d}}
send "$cmd\t"
expect -ex "$cmd"
expect {
    -re "\r\nbar\\s+bar bar.d/\\s+foo\\s+foo.d/"  { pass "$test" }
        # Directories might not be suffixed with a slash (/).  This is because
        # _filedir only works if `-o filenames' is in effect, which isn't the
        # case for `screen' on bash-3, so an expected failure (xfail)
    -re "\r\nbar\\s+bar bar.d\\s+foo\\s+foo.d" { 
        if {[lindex $BASH_VERSINFO 0] < 4} {xfail "$test"} {fail "$test"}
    }
    -re "\r\nbar\\s+bar\\\\ bar.d/\\s+foo\\s+foo.d/" {
        # On bash-3, the space in `bar bar.d' is escaped with a backslash
        # as a side-effect of emulating `-o filenames'.
        if {[lindex $BASH_VERSINFO 0] <= 3} {pass "$test"} {fail "$test"}
    }
    -re $prompt { unresolved "$test at prompt" }
    default { unresolved "$test" }
}; # expect
sync_after_int $prompt
assert_bash_exec {cd "$TESTDIR"}



sync_after_int


teardown