summaryrefslogtreecommitdiff
path: root/src/testdir/test73.in
blob: 3518e8087f938a457ecad4cefd888cd5c31af08c (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Tests for find completion.

STARTTEST
:so small.vim
:" Do all test in a separate window to avoid E211 when we recursively
:" delete the Xfind directory during cleanup
:"
:" This will cause a few errors, do it silently.
:set visualbell
:set nocp viminfo+=nviminfo
:"
:function! DeleteDirectory(dir)
: if has("win16") || has("win32") || has("win64") || has("dos16") || has("dos32")
:  exec "silent !rmdir /Q /S " . a:dir
: else
:  exec "silent !rm -rf " . a:dir
: endif
:endfun
:" On windows a stale "Xfind" directory may exist, remove it so that
:" we start from a clean state.
:call DeleteDirectory("Xfind")
:new
:let cwd=getcwd()
:let test_out = cwd . '/test.out'
:call mkdir('Xfind')
:cd Xfind
:set path=
:find 	
:exec "w! " . test_out
:close
:new
:set path=.
:find 	
:exec "w >>" . test_out
:close
:new
:set path=.,,
:find 	
:exec "w >>" . test_out
:close
:new
:set path=./**
:find 	
:exec "w >>" . test_out
:close
:new
:" We shouldn't find any file at this point, test.out must be empty.
:call mkdir('in')
:cd in
:call mkdir('path')
:exec "cd " . cwd
:e Xfind/file.txt
SHoly Grail:w
:e Xfind/in/file.txt
SJimmy Hoffa:w
:e Xfind/in/stuff.txt
SAnother Holy Grail:w
:e Xfind/in/path/file.txt
SE.T.:w
:set path=Xfind/**
:find file	
:exec "w >>" . test_out
:find file		
:exec "w >>" . test_out
:find file			
:exec "w >>" . test_out
:" Rerun the previous three find completions, using fullpath in 'path'
:exec "set path=" . cwd . "/Xfind/**"
:find file	
:exec "w >>" .  test_out
:find file		
:exec "w >>" . test_out
:find file			
:exec "w >>" . test_out
:" Same steps again, using relative and fullpath items that point to the same
:" recursive location.
:" This is to test that there are no duplicates in the completion list.
:exec "set path+=Xfind/**"
:find file	
:exec "w >>" .  test_out
:find file		
:exec "w >>" . test_out
:find file			
:exec "w >>" . test_out
:find file		
:" Test find completion for directory of current buffer, which at this point
:" is Xfind/in/file.txt.
:set path=.
:find st	
:exec "w >>" .  test_out
:" Test find completion for empty path item ",," which is the current directory
:cd Xfind
:set path=,,
:find f		
:exec "w >>" . test_out
:" Test shortening of
:"
:"    foo/x/bar/voyager.txt
:"    foo/y/bar/voyager.txt
:"
:" When current directory is above foo/ they should be shortened to (in order
:" of appearance):
:"
:"    x/bar/voyager.txt
:"    y/bar/voyager.txt
:call mkdir('foo')
:cd foo
:call mkdir('x')
:call mkdir('y')
:cd x
:call mkdir('bar')
:cd ..
:cd y
:call mkdir('bar')
:cd ..
:cd ..
:" We should now be in the Xfind directory
:e foo/x/bar/voyager.txt
SVoyager 1:w
:e foo/y/bar/voyager.txt
SVoyager 2:w
:exec "set path=" . cwd . "/Xfind/**"
:find voyager	
:exec "w >>" . test_out
:find voyager		
:exec "w >>" . test_out
:"
:" When current directory is .../foo/y/bar they should be shortened to (in
:" order of appearance):
:"
:"    ./voyager.txt
:"    x/bar/voyager.txt
:cd foo
:cd y
:cd bar
:find voyager	
:exec "w >> " . test_out
:find voyager		
:exec "w >> " . test_out
:" Check the opposite too:
:cd ..
:cd ..
:cd x
:cd bar
:find voyager	
:exec "w >> " . test_out
:find voyager		
:exec "w >> " . test_out
:" Check for correct handling of shorten_fname()'s behavior on windows
:exec "cd " . cwd . "/Xfind/in"
:find file	
:exec "w >>" . test_out
:q
:exec "cd " . cwd
:call DeleteDirectory("Xfind")
:qa!
ENDTEST