regressions.vader 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. **********************************************************************
  2. Execute (#112 On-demand loading should not suppress messages from ftplugin):
  3. call ResetPlug()
  4. call plug#begin('$PLUG_FIXTURES')
  5. Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
  6. call plug#end()
  7. redir => out
  8. tabnew a.c
  9. redir END
  10. Assert stridx(out, 'ftplugin-c') >= 0, 'Unexpected output (1): '.out
  11. * The same applies to plug#load())
  12. call ResetPlug()
  13. redir => out
  14. call plug#load('ftplugin-msg')
  15. redir END
  16. Assert stridx(out, 'ftplugin-c') >= 0, 'Unexpected output (2): '.out
  17. q
  18. **********************************************************************
  19. Execute (#114 Should not contain empty path in &rtp):
  20. call plug#begin('/tmp/vim-plug-test/plugged')
  21. call plug#end()
  22. Log &rtp
  23. Assert &rtp !~ ',,', 'Commas'
  24. Assert &rtp !~ '^,', 'Comma prefix'
  25. Assert &rtp !~ ',$', 'Comma suffix'
  26. **********************************************************************
  27. Execute (#130 Proper cleanup of on-demand loading triggers):
  28. augroup PlugLOD
  29. autocmd!
  30. augroup END
  31. " Cleared on command
  32. call ReloadPlug()
  33. call plug#begin('/tmp/vim-plug-test/plugged')
  34. Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
  35. call plug#end()
  36. PlugInstall | q
  37. Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
  38. Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
  39. Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
  40. silent! EmojiCommand
  41. Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
  42. Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
  43. Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
  44. " Cleared on FileType
  45. call ReloadPlug()
  46. call plug#begin('/tmp/vim-plug-test/plugged')
  47. Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
  48. call plug#end()
  49. Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
  50. Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
  51. setf emoji
  52. Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
  53. Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
  54. **********************************************************************
  55. Execute (#131 Syntax error):
  56. call plug#begin('/proc/no-permission')
  57. Plug 'junegunn/vim-emoji'
  58. call plug#end()
  59. redir => out
  60. silent PlugInstall
  61. redir END
  62. Assert out =~ 'Invalid plug directory: /proc/no-permission', out
  63. **********************************************************************
  64. Execute (#139-1 Using new remote branch):
  65. " Make sure to remove the clone
  66. call plug#begin('/tmp/vim-plug-test/plugged')
  67. call plug#end()
  68. PlugClean!
  69. " Install master branch
  70. call plug#begin('/tmp/vim-plug-test/plugged')
  71. Plug expand('file:////tmp/vim-plug-test/new-branch')
  72. call plug#end()
  73. PlugUpdate
  74. unlet! g:foo g:bar g:baz
  75. call ResetPlug()
  76. call plug#load('new-branch')
  77. Assert exists('g:foo'), 'g:foo should be found (1)'
  78. Assert !exists('g:bar'), 'g:bar should not be found (1)'
  79. Assert !exists('g:baz'), 'g:baz should not be found (1)'
  80. " Create a new branch on origin
  81. call system('cd /tmp/vim-plug-test/new-branch && git checkout -b new &&'
  82. \. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
  83. \. 'git commit -m second')
  84. " We're setting up two plugins so that parallel installer is used
  85. call plug#begin('/tmp/vim-plug-test/plugged')
  86. Plug 'junegunn/seoul256.vim'
  87. Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
  88. call plug#end()
  89. PlugUpdate
  90. silent %y
  91. Log @"
  92. Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
  93. unlet! g:foo g:bar g:baz
  94. call ResetPlug()
  95. call plug#load('new-branch')
  96. Assert exists('g:foo'), 'g:foo should be found (2)'
  97. Assert exists('g:bar'), 'g:bar should be found (2)'
  98. Assert !exists('g:baz'), 'g:baz should not be found (2)'
  99. call PlugStatusSorted()
  100. Expect:
  101. - new-branch: OK
  102. - seoul256.vim: OK
  103. Finished. 0 error(s).
  104. [==]
  105. Execute (#139-2 Using yet another new remote branch):
  106. " Create another branch on origin
  107. call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
  108. \. 'git checkout -b brand-new &&'
  109. \. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
  110. \. 'git commit -m third')
  111. " Test Vim installer here
  112. call plug#begin('/tmp/vim-plug-test/plugged')
  113. Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'brand-new' }
  114. call plug#end()
  115. PlugUpdate
  116. silent %y
  117. Log @"
  118. Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
  119. unlet! g:foo g:bar g:baz
  120. call ResetPlug()
  121. call plug#load('new-branch')
  122. Assert exists('g:foo'), 'g:foo should be found'
  123. Assert !exists('g:bar'), 'g:bar should not be found'
  124. Assert exists('g:baz'), 'g:baz should be found'
  125. call PlugStatusSorted()
  126. Expect:
  127. - new-branch: OK
  128. Finished. 0 error(s).
  129. [=]
  130. Execute (#139-3 Should fail when not possible to fast-forward):
  131. " Commit on cloned repo
  132. call system('cd /tmp/vim-plug-test/plugged/new-branch && git checkout master &&'
  133. \. 'touch foobar && git add foobar && git commit -m foobar')
  134. " Different commit on remote
  135. call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
  136. \. 'touch foobaz && git add foobaz && git commit -m foobaz')
  137. for multi in [0, 1]
  138. call plug#begin('/tmp/vim-plug-test/plugged')
  139. if multi
  140. Plug 'junegunn/seoul256.vim'
  141. endif
  142. Plug expand('file:////tmp/vim-plug-test/new-branch')
  143. call plug#end()
  144. PlugUpdate
  145. silent %y
  146. Assert @" =~ 'Not possible to fast-forward', @"
  147. endfor
  148. q
  149. **********************************************************************
  150. Execute (#145: Merging on-demand loading triggers - cmd):
  151. unlet! g:xxx g:yyy
  152. call plug#begin()
  153. Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
  154. Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
  155. call plug#end()
  156. silent! XXX
  157. Assert exists('g:xxx'), 'xxx is not loaded'
  158. Assert exists('g:yyy'), 'yyy is not loaded'
  159. Assert !exists(':YYY')
  160. Execute (#145: Merging on-demand loading triggers - map):
  161. unlet! g:xxx g:yyy
  162. call ReloadPlug()
  163. call plug#begin()
  164. Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
  165. Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
  166. call plug#end()
  167. Assert !empty(mapcheck("<Plug>(xxx)"))
  168. Assert !empty(mapcheck("<Plug>(yyy)"))
  169. # FIXME feedkeys() cannot be tested with Vader
  170. call plug#load('xxx', 'yyy')
  171. Assert empty(mapcheck("<Plug>(xxx)"))
  172. Assert empty(mapcheck("<Plug>(yyy)"))
  173. **********************************************************************
  174. Execute (#159: shell=/bin/tcsh):
  175. let org = &shell
  176. try
  177. set shell=/bin/tcsh
  178. call plug#begin('/tmp/vim-plug-test/plugged')
  179. Plug 'junegunn/seoul256.vim'
  180. call plug#end()
  181. PlugStatus
  182. Log getline(1, '$')
  183. q
  184. AssertEqual '/bin/tcsh', &shell
  185. finally
  186. let &shell = org
  187. endtry
  188. **********************************************************************
  189. Execute (#154: Spaces in &rtp should not be escaped):
  190. call plug#begin('/tmp/vim-plug-test/plug it')
  191. Plug 'foo/seoul256 vim'
  192. call plug#end()
  193. Log &rtp
  194. Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
  195. **********************************************************************
  196. Execute (#184: Duplicate entries in &rtp):
  197. call plug#begin('/tmp/vim-plug-test/plugged')
  198. Plug 'foo/plugin1'
  199. \| Plug 'foo/plugin0'
  200. Plug 'foo/plugin2'
  201. \| Plug 'foo/plugin0'
  202. \| Plug 'foo/plugin1'
  203. call plug#end()
  204. Log &rtp
  205. AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
  206. **********************************************************************
  207. Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
  208. unlet! g:loaded_easy_align_plugin
  209. silent! delc EasyAlign
  210. call ReloadPlug()
  211. call plug#begin('/tmp/vim-plug-test/plugged')
  212. Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
  213. call plug#end()
  214. PlugInstall | q
  215. Assert &rtp !~ '/vim-easy-align', 'Plugin should not be in &rtp'
  216. %EasyAlign=
  217. Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
  218. call plug#begin('/tmp/vim-plug-test/plugged')
  219. Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
  220. call plug#end()
  221. Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
  222. **********************************************************************
  223. Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
  224. call plug#begin('/tmp/vim-plug-test/plugged')
  225. call plug#end()
  226. PlugClean!
  227. " Shallow clone. We should have at least 2 plugins to enable parallel installer.
  228. call plug#begin('/tmp/vim-plug-test/plugged')
  229. Plug 'junegunn/vim-easy-align'
  230. Plug 'junegunn/seoul256.vim'
  231. call plug#end()
  232. PlugUpdate
  233. Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
  234. " Now unshallowed
  235. call plug#begin('/tmp/vim-plug-test/plugged')
  236. Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
  237. Plug 'junegunn/seoul256.vim'
  238. call plug#end()
  239. PlugUpdate
  240. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
  241. q
  242. **********************************************************************
  243. Execute (#474: Load ftdetect files in filetypedetect augroup):
  244. call plug#begin('/tmp/vim-plug-test/plugged')
  245. Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
  246. call plug#end()
  247. PlugInstall!
  248. q
  249. tabnew /tmp/vim-plug-test/any.rs
  250. AssertEqual 'rust', &filetype
  251. Log &filetype
  252. filetype detect
  253. AssertEqual 'rust', &filetype
  254. Log &filetype
  255. bd
  256. **********************************************************************
  257. Execute (#489/#587 On-demand loading with 'on' option should trigger BufRead autocmd w/o nomodeline):
  258. call plug#begin('$PLUG_FIXTURES')
  259. Plug 'foo/ftplugin-msg', { 'on': 'XXX' }
  260. call plug#end()
  261. tabnew a.java
  262. call setline(1, '// vim: set filetype=lava:')
  263. redir => out
  264. silent! XXX
  265. redir END
  266. Assert stridx(out, 'ftplugin-java') >= 0
  267. AssertEqual 'lava', &filetype
  268. q!
  269. **********************************************************************
  270. Execute (Cursor moved to another window during post-update hook):
  271. function! DoSplit(...)
  272. new
  273. call setline(1, 'empty')
  274. endfunction
  275. call plug#begin('/tmp/vim-plug-test/plugged')
  276. Plug 'junegunn/rust.vim', { 'do': function('DoSplit') }
  277. call plug#end()
  278. PlugInstall!
  279. AssertEqual 1, line('$')
  280. AssertEqual 'empty', getline(1)
  281. q!
  282. q
  283. **********************************************************************
  284. Execute (#593 Add plugin to &rtp before running post-update hook with : prefix):
  285. call ReloadPlug()
  286. call plug#begin()
  287. Plug 'junegunn/vim-pseudocl', { 'on': 'XXX', 'do': ':let g:bar = pseudocl#complete#extract_words(''a b'')' }
  288. call plug#end()
  289. PlugInstall!
  290. AssertEqual ['a', 'b'], g:bar
  291. **********************************************************************
  292. Execute (#602 Confusion with branch name and path name):
  293. call plug#begin()
  294. Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'plugin' }
  295. call plug#end()
  296. PlugUpdate
  297. call PlugStatusSorted()
  298. Expect:
  299. - new-branch: OK
  300. Finished. 0 error(s).
  301. [=]
  302. **********************************************************************
  303. Execute (PlugStatus showed error with wildcard tag):
  304. call plug#begin()
  305. Plug 'junegunn/vim-easy-align', { 'tag': '*' }
  306. call plug#end()
  307. PlugUpdate
  308. call PlugStatusSorted()
  309. Expect:
  310. - vim-easy-align: OK
  311. Finished. 0 error(s).
  312. [=]