-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathregressions.vader
375 lines (313 loc) · 11.4 KB
/
regressions.vader
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
**********************************************************************
Execute (#112 On-demand loading should not suppress messages from ftplugin):
call ResetPlug()
call plug#begin('$PLUG_FIXTURES')
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
call plug#end()
redir => out
tabnew a.c
redir END
Assert stridx(out, 'ftplugin-c') >= 0, 'Unexpected output (1): '.out
* The same applies to plug#load())
call ResetPlug()
redir => out
call plug#load('ftplugin-msg')
redir END
Assert stridx(out, 'ftplugin-c') >= 0, 'Unexpected output (2): '.out
q
**********************************************************************
Execute (#114 Should not contain empty path in &rtp):
call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end()
Log &rtp
Assert &rtp !~ ',,', 'Commas'
Assert &rtp !~ '^,', 'Comma prefix'
Assert &rtp !~ ',$', 'Comma suffix'
**********************************************************************
Execute (#130 Proper cleanup of on-demand loading triggers):
augroup PlugLOD
autocmd!
augroup END
" Cleared on command
call ReloadPlug()
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
call plug#end()
PlugInstall | q
call mkdir(g:plugs['vim-emoji'].dir.'/after/plugin', 'p')
Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
silent! EmojiCommand
Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
" Cleared on FileType
call ReloadPlug()
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
call plug#end()
Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
setf emoji
Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
**********************************************************************
Execute (#131 Syntax error):
call plug#begin('/proc/no-permission')
Plug 'junegunn/vim-emoji'
call plug#end()
redir => out
silent PlugInstall
redir END
Assert out =~ 'Invalid plug directory: /proc/no-permission', out
**********************************************************************
Execute (#139-1 Using new remote branch):
" Make sure to remove the clone
call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end()
PlugClean!
" Install master branch
call plug#begin('/tmp/vim-plug-test/plugged')
Plug expand('file:////tmp/vim-plug-test/new-branch')
call plug#end()
PlugUpdate
unlet! g:foo g:bar g:baz
call ResetPlug()
call plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found (1)'
Assert !exists('g:bar'), 'g:bar should not be found (1)'
Assert !exists('g:baz'), 'g:baz should not be found (1)'
" Create a new branch on origin
call system('cd /tmp/vim-plug-test/new-branch && git checkout -b new &&'
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
\. 'git commit -m second')
" We're setting up two plugins so that parallel installer is used
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/seoul256.vim'
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
call plug#end()
PlugUpdate
silent %y
Log @"
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
unlet! g:foo g:bar g:baz
call ResetPlug()
call plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found (2)'
Assert exists('g:bar'), 'g:bar should be found (2)'
Assert !exists('g:baz'), 'g:baz should not be found (2)'
call PlugStatusSorted()
Expect:
- new-branch: OK
- seoul256.vim: OK
Finished. 0 error(s).
[==]
Execute (#139-2 Using yet another new remote branch):
" Create another branch on origin
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
\. 'git checkout -b brand-new &&'
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
\. 'git commit -m third')
" Test Vim installer here
call plug#begin('/tmp/vim-plug-test/plugged')
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'brand-new' }
call plug#end()
PlugUpdate
silent %y
Log @"
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
unlet! g:foo g:bar g:baz
call ResetPlug()
call plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found'
Assert !exists('g:bar'), 'g:bar should not be found'
Assert exists('g:baz'), 'g:baz should be found'
call PlugStatusSorted()
Expect:
- new-branch: OK
Finished. 0 error(s).
[=]
Execute (#139-3 Should fail when not possible to fast-forward):
" Commit on cloned repo
call system('cd /tmp/vim-plug-test/plugged/new-branch && git checkout master &&'
\. 'touch foobar && git add foobar && git commit -m foobar')
" Different commit on remote
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
for multi in [0, 1]
call plug#begin('/tmp/vim-plug-test/plugged')
if multi
Plug 'junegunn/seoul256.vim'
endif
Plug expand('file:////tmp/vim-plug-test/new-branch')
call plug#end()
PlugUpdate
silent %y
Assert @" =~ 'Not possible to fast-forward', @"
endfor
q
**********************************************************************
Execute (#145: Merging on-demand loading triggers - cmd):
unlet! g:xxx g:yyy
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
call plug#end()
silent! XXX
Assert exists('g:xxx'), 'xxx is not loaded'
Assert exists('g:yyy'), 'yyy is not loaded'
Assert !exists(':YYY')
Execute (#145: Merging on-demand loading triggers - map):
unlet! g:xxx g:yyy
call ReloadPlug()
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
call plug#end()
Assert !empty(mapcheck("<Plug>(xxx)"))
Assert !empty(mapcheck("<Plug>(yyy)"))
# FIXME feedkeys() cannot be tested with Vader
call plug#load('xxx', 'yyy')
Assert empty(mapcheck("<Plug>(xxx)"))
Assert empty(mapcheck("<Plug>(yyy)"))
**********************************************************************
Execute (#159: shell=/bin/tcsh):
let org = &shell
try
set shell=/bin/tcsh
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugStatus
Log getline(1, '$')
q
AssertEqual '/bin/tcsh', &shell
finally
let &shell = org
endtry
**********************************************************************
Execute (#154: Spaces in &rtp should not be escaped):
call plug#begin('/tmp/vim-plug-test/plug it')
Plug 'foo/seoul256 vim'
call plug#end()
Log &rtp
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
**********************************************************************
Execute (#184: Duplicate entries in &rtp):
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'foo/plugin1'
\| Plug 'foo/plugin0'
Plug 'foo/plugin2'
\| Plug 'foo/plugin0'
\| Plug 'foo/plugin1'
call plug#end()
Log &rtp
AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
**********************************************************************
Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
unlet! g:loaded_easy_align_plugin
silent! delc EasyAlign
call ReloadPlug()
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
call plug#end()
PlugInstall | q
Assert &rtp !~ '/vim-easy-align', 'Plugin should not be in &rtp'
%EasyAlign=
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
call plug#end()
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
**********************************************************************
Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end()
PlugClean!
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugUpdate
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
" Now unshallowed
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugUpdate
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
q
**********************************************************************
Execute (#474: Load ftdetect files in filetypedetect augroup):
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
call plug#end()
PlugInstall!
q
tabnew /tmp/vim-plug-test/any.rs
AssertEqual 'rust', &filetype
Log &filetype
filetype detect
AssertEqual 'rust', &filetype
Log &filetype
bd
**********************************************************************
Execute (#489/#587 On-demand loading with 'on' option should trigger BufRead autocmd w/o nomodeline):
call plug#begin('$PLUG_FIXTURES')
Plug 'foo/ftplugin-msg', { 'on': 'XXX' }
call plug#end()
tabnew a.java
call setline(1, '// vim: set filetype=lava:')
redir => out
silent! XXX
redir END
Assert stridx(out, 'ftplugin-java') >= 0
AssertEqual 'lava', &filetype
q!
**********************************************************************
Execute (Cursor moved to another window during post-update hook):
function! DoSplit(...)
new
call setline(1, 'empty')
endfunction
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/rust.vim', { 'do': function('DoSplit') }
call plug#end()
PlugInstall!
AssertEqual 1, line('$')
AssertEqual 'empty', getline(1)
q!
q
**********************************************************************
Execute (#593 Add plugin to &rtp before running post-update hook with : prefix):
call ReloadPlug()
call plug#begin()
Plug 'junegunn/vim-pseudocl', { 'on': 'XXX', 'do': ':let g:bar = pseudocl#complete#extract_words(''a b'')' }
call plug#end()
PlugInstall!
AssertEqual ['a', 'b'], g:bar
**********************************************************************
Execute (#602 Confusion with branch name and path name):
call plug#begin()
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'plugin' }
call plug#end()
PlugUpdate
call PlugStatusSorted()
Expect:
- new-branch: OK
Finished. 0 error(s).
[=]
**********************************************************************
Execute (PlugStatus showed error with wildcard tag):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'tag': '*' }
call plug#end()
PlugUpdate
call PlugStatusSorted()
Expect:
- vim-easy-align: OK
Finished. 0 error(s).
[=]