summaryrefslogtreecommitdiff
path: root/test/lib/completions/upgradepkg.exp
blob: 4783aec32784ae7e4e003deca10583626459eea5 (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
proc setup {} {
    save_env
}


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


setup


assert_complete_any "upgradepkg -"


sync_after_int


set test "--<TAB> should complete all long options"
set options [list --dry-run --install-new --reinstall --verbose]
assert_complete $options "upgradepkg --" $test


sync_after_int


set test "should complete *.t\[gbxl\]z files and dirs"
set dir $::srcdir/fixtures/slackware/home
set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
           \\( -type d -printf '%P/\\n' \\) -o \
           \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"]
assert_complete_dir $files "upgradepkg " $dir $test


sync_after_int


set test "should complete *.t\[gbxl\]z files and dirs after % sign"
set oldpkg "xx-2.0-i486-2"
set dir $::srcdir/fixtures/slackware/home
set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
           \\( -type d -printf '$oldpkg%%%P/\\n' \\) -o \
           \\( -type f -name '*.t\[bglx\]z' -printf '$oldpkg%%%P\\n' \\)"] "\n"]
assert_complete_dir $files "upgradepkg $oldpkg%" $dir $test


sync_after_int


teardown