File: compgen.exp

package info (click to toggle)
bash-completion 1%3A1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,508 kB
  • ctags: 24
  • sloc: exp: 5,659; sh: 741; makefile: 203; perl: 59
file content (52 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download
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


if {[lindex $::BASH_VERSINFO 0] <= 3} {
    set test {compgen -f a\\\\\\\'b/ on bash-3 should return a\'b/c};
    set cmd {compgen -f a\\\\\\\'b/}
} else {
    set test {compgen -f a\\\'b/ on bash-4 should return a\'b/c};
    set cmd {compgen -f a\\\'b/}
}; # if
set dir fixtures/compgen
set prompt "/$dir/@"
assert_bash_exec "cd $dir" "" $prompt
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
    -re {a\\\'b/c} {
        # On bash-3.2, compgen returns inconsequent output
        if {
            [lindex $::BASH_VERSINFO 0] >= 4 || (
                [lindex $::BASH_VERSINFO 0] == 3 &&
                [lindex $::BASH_VERSINFO 1] == 2
            )
        } {pass $test} else {fail $test}
    }
    -re {a'b/c} {
        if {[lindex $::BASH_VERSINFO 0] <= 3 } \
            {pass $test} else {fail $test}
    }
    -re $prompt { pass "$test" }
    -re eof { unresolved "eof" }
}; # expect
sync_after_int $prompt
assert_bash_exec {cd "$TESTDIR"}

#assert_bash_list_dir {a\\\'b/c} $cmd fixtures/compgen


sync_after_int


teardown