File: man.exp

package info (click to toggle)
bash-completion 1%3A2.8-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,860 kB
  • sloc: exp: 9,759; makefile: 1,104; sh: 261; perl: 56; python: 47; xml: 29; ansic: 7; ruby: 2
file content (76 lines) | stat: -rw-r--r-- 1,996 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
proc setup {} {
    assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man:$::srcdirabs/tmp/man"
    save_env

    if {! [is_cygwin]} {  # Colon not allowed in filenames
        assert_bash_exec {(cd $TESTDIR/tmp && mkdir -p man/man3 && touch man/man3/Bash::Completion.3pm.gz || true)}
    }
}


proc teardown {} {
    assert_env_unmodified {
        /OLDPWD/d
        /OLDMANPATH/d
    }

    if {! [is_cygwin]} {
        assert_bash_exec {(cd $TESTDIR/tmp && rm -r man || true)}
    }
}


setup


# Something we assume a system installed man page present for
set assumed_present "man"

assert_complete "bash-completion-testcase" "man bash-completion-testcas"
sync_after_int

assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man
sync_after_int

if {! [is_cygwin]} {
    assert_complete "Bash::Completion" "man Bash::C"
    sync_after_int
}

assert_complete_dir "man/quux.8" "man man/" $::srcdir/fixtures/man
sync_after_int

set desc "man $assumed_present with MANPATH having no leading/trailing colon"
assert_no_complete "man $assumed_present" "$desc should not complete"
sync_after_int

# Trailing colon in MANPATH: append system default search path
assert_bash_exec "OLDMANPATH=\$MANPATH; MANPATH=\$MANPATH:"
set desc "with trailing colon in MANPATH"

set cmd "man $assumed_present"
assert_complete_any "$cmd" "$cmd $desc should complete"
sync_after_int

set cmd "man bash-completion-testcas"
assert_complete "bash-completion-testcase" "$cmd" "$cmd $desc should complete"
sync_after_int

assert_bash_exec "MANPATH=\$OLDMANPATH"

# Leading colon in MANPATH: prepend system default search path
assert_bash_exec "OLDMANPATH=\$MANPATH; MANPATH=:\$MANPATH"
set desc "with leading colon in MANPATH"

set cmd "man $assumed_present"
assert_complete_any "$cmd" "$cmd $desc should complete"
sync_after_int

set cmd "man bash-completion-testcas"
assert_complete "bash-completion-testcase" "$cmd" "$cmd $desc should complete"
sync_after_int

assert_bash_exec "MANPATH=\$OLDMANPATH"


teardown