summaryrefslogtreecommitdiff
path: root/test/lib/completions/find.exp
blob: 4b1728dc9ef360617f3ba792c775704d0dfff20e (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
proc setup {} {
    save_env
}; # setup()


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


setup


assert_complete_any "find "


sync_after_int


assert_complete_any "find -fstype "


sync_after_int


set options [list -daystart -depth -follow -help \
        -ignore_readdir_race -maxdepth -mindepth -mindepth -mount \
        -noignore_readdir_race -noleaf -regextype -version -warn -nowarn \
        -xdev \
        -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false \
        -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename \
        -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm \
        -readable -regex -samefile -size -true -type -uid -used -user \
        -wholename -writable -xtype -context \
        -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \
        -print -print0 -printf -prune -quit]
assert_complete $options {find -}


sync_after_int


set test "-wholename should complete files/dirs"
set dir fixtures/shared/default
set files [split [exec bash -c "cd $dir && ls -p"] "\n"]
assert_complete_dir $files "find -wholename " $dir


sync_after_int


set test "-uid should complete uids"
    # Complete
set cmd "find -uid "
send "$cmd\t"
expect {
    -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
    -re /@ { unresolved "$test at prompt" }
    -re eof { unresolved "eof" }
}; # expect


sync_after_int


set test "-gid should complete gids"
    # Complete
set cmd "find -gid "
send "$cmd\t"
expect {
    -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
    -re /@ { unresolved "$test at prompt" }
    -re eof { unresolved "eof" }
}; # expect


sync_after_int


teardown