summaryrefslogtreecommitdiff
path: root/test/lib/completions/find.exp
blob: 0fb5c62c5ed8c1839ef403bad98d7af61ad81a1e (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
proc setup {} {
    save_env
}; # setup()


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


setup


assert_complete_any "find "


sync_after_int


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


sync_after_int


set test "-wholename should complete files/dirs"
set dir fixture1
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