regressions.vader 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. **********************************************************************
  2. Execute (#112 On-demand loading should not suppress messages from ftplugin):
  3. call plug#begin('$PLUG_FIXTURES')
  4. Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
  5. call plug#end()
  6. redir => out
  7. tabnew a.c
  8. redir END
  9. Assert stridx(out, 'ftplugin') >= 0
  10. * The same applies to plug#load())
  11. redir => out
  12. call plug#load('ftplugin-msg')
  13. redir END
  14. Assert stridx(out, 'ftplugin') >= 0
  15. q
  16. **********************************************************************
  17. Execute (#114 Should not contain empty path in &rtp):
  18. call plug#begin('/tmp/plugged')
  19. call plug#end()
  20. Log &rtp
  21. Assert &rtp !~ ',,', 'Commas'
  22. Assert &rtp !~ '^,', 'Comma prefix'
  23. Assert &rtp !~ ',$', 'Comma suffix'
  24. **********************************************************************
  25. Execute (#130 Proper cleanup of on-demand loading triggers):
  26. augroup PlugLOD
  27. autocmd!
  28. augroup END
  29. " Cleared on command
  30. call ReloadPlug()
  31. call plug#begin('/tmp/plugged')
  32. Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
  33. call plug#end()
  34. PlugInstall | q
  35. Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
  36. Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
  37. Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
  38. silent! EmojiCommand
  39. Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
  40. Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
  41. Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
  42. " Cleared on FileType
  43. call ReloadPlug()
  44. call plug#begin('/tmp/plugged')
  45. Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
  46. call plug#end()
  47. Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
  48. Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
  49. setf emoji
  50. Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
  51. Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
  52. **********************************************************************
  53. Execute (#131 Syntax error):
  54. call plug#begin('/no-permission')
  55. Plug 'junegunn/vim-emoji'
  56. call plug#end()
  57. redir => out
  58. silent PlugInstall
  59. redir END
  60. Assert out =~ 'Invalid plug directory: /no-permission'
  61. **********************************************************************
  62. Execute (#139-1 Using new remote branch):
  63. " Make sure to remove the clone
  64. call plug#begin('/tmp/plugged')
  65. call plug#end()
  66. PlugClean!
  67. " Install master branch
  68. call plug#begin('/tmp/plugged')
  69. Plug expand('file:////tmp/new-branch')
  70. call plug#end()
  71. PlugUpdate
  72. unlet! g:foo g:bar g:baz
  73. call plug#load('new-branch')
  74. Assert exists('g:foo'), 'g:foo should be found'
  75. Assert !exists('g:bar'), 'g:bar should not be found'
  76. Assert !exists('g:baz'), 'g:baz should not be found'
  77. " Create a new branch on origin
  78. call system('cd /tmp/new-branch && git checkout -b new &&'
  79. \. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
  80. \. 'git commit -m second')
  81. " We're setting up two plugins so that parallel installer is used
  82. call plug#begin('/tmp/plugged')
  83. Plug 'junegunn/seoul256.vim'
  84. Plug expand('file:////tmp/new-branch'), { 'branch': 'new' }
  85. call plug#end()
  86. PlugUpdate
  87. silent %y
  88. Log @"
  89. Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
  90. unlet! g:foo g:bar g:baz
  91. call plug#load('new-branch')
  92. Assert exists('g:foo'), 'g:foo should be found'
  93. Assert exists('g:bar'), 'g:bar should be found'
  94. Assert !exists('g:baz'), 'g:baz should not be found'
  95. call PlugStatusSorted()
  96. Expect:
  97. - new-branch: OK
  98. - seoul256.vim: OK
  99. Finished. 0 error(s).
  100. [==]
  101. Execute (#139-2 Using yet another new remote branch):
  102. " Create another branch on origin
  103. call system('cd /tmp/new-branch && git checkout master &&'
  104. \. 'git checkout -b brand-new &&'
  105. \. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
  106. \. 'git commit -m third')
  107. " Test Vim installer here
  108. call plug#begin('/tmp/plugged')
  109. Plug expand('file:////tmp/new-branch'), { 'branch': 'brand-new' }
  110. call plug#end()
  111. PlugUpdate
  112. silent %y
  113. Log @"
  114. Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
  115. unlet! g:foo g:bar g:baz
  116. call plug#load('new-branch')
  117. Assert exists('g:foo'), 'g:foo should be found'
  118. Assert !exists('g:bar'), 'g:bar should not be found'
  119. Assert exists('g:baz'), 'g:baz should be found'
  120. call PlugStatusSorted()
  121. Expect:
  122. - new-branch: OK
  123. Finished. 0 error(s).
  124. [=]
  125. Execute (#139-3 Should fail when not possible to fast-forward):
  126. " Commit on cloned repo
  127. call system('cd /tmp/plugged/new-branch && git checkout master &&'
  128. \. 'touch foobar && git add foobar && git commit -m foobar')
  129. " Different commit on remote
  130. call system('cd /tmp/new-branch && git checkout master &&'
  131. \. 'touch foobaz && git add foobaz && git commit -m foobaz')
  132. for multi in [0, 1]
  133. call plug#begin('/tmp/plugged')
  134. if multi
  135. Plug 'junegunn/seoul256.vim'
  136. endif
  137. Plug expand('file:////tmp/new-branch')
  138. call plug#end()
  139. PlugUpdate
  140. silent %y
  141. Assert @" =~ 'Not possible to fast-forward', @"
  142. endfor
  143. q
  144. **********************************************************************
  145. Execute (#145: Merging on-demand loading triggers - cmd):
  146. unlet! g:xxx g:yyy
  147. call plug#begin()
  148. Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
  149. Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
  150. call plug#end()
  151. silent! XXX
  152. Assert exists('g:xxx'), 'xxx is not loaded'
  153. Assert exists('g:yyy'), 'yyy is not loaded'
  154. Assert !exists(':YYY')
  155. Execute (#145: Merging on-demand loading triggers - map):
  156. unlet! g:xxx g:yyy
  157. call ReloadPlug()
  158. call plug#begin()
  159. Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
  160. Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
  161. call plug#end()
  162. Assert !empty(mapcheck("<Plug>(xxx)"))
  163. Assert !empty(mapcheck("<Plug>(yyy)"))
  164. # FIXME feedkeys() cannot be tested with Vader
  165. call plug#load('xxx', 'yyy')
  166. Assert empty(mapcheck("<Plug>(xxx)"))
  167. Assert empty(mapcheck("<Plug>(yyy)"))
  168. **********************************************************************
  169. Execute (#159: shell=/bin/tcsh):
  170. let org = &shell
  171. try
  172. set shell=/bin/tcsh
  173. call plug#begin('/tmp/plugged')
  174. Plug 'junegunn/seoul256.vim'
  175. call plug#end()
  176. PlugStatus
  177. Log getline(1, '$')
  178. q
  179. AssertEqual '/bin/tcsh', &shell
  180. finally
  181. let &shell = org
  182. endtry
  183. **********************************************************************
  184. Execute (#154: Spaces in &rtp should not be escaped):
  185. call plug#begin('/tmp/plug it')
  186. Plug 'seoul256 vim'
  187. call plug#end()
  188. Log &rtp
  189. Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
  190. **********************************************************************
  191. Execute (#184: Duplicate entries in &rtp):
  192. call plug#begin('/tmp/plugged')
  193. Plug 'plugin1'
  194. \| Plug 'plugin0'
  195. Plug 'plugin2'
  196. \| Plug 'plugin0'
  197. \| Plug 'plugin1'
  198. call plug#end()
  199. Log &rtp
  200. AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
  201. **********************************************************************
  202. Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
  203. unlet! g:loaded_easy_align_plugin
  204. silent! delc EasyAlign
  205. call ReloadPlug()
  206. call plug#begin('/tmp/plugged')
  207. Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
  208. call plug#end()
  209. PlugInstall | q
  210. Assert &rtp !~ '/vim-easy-align', 'Plugin should not be in &rtp'
  211. %EasyAlign=
  212. Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
  213. call plug#begin('/tmp/plugged')
  214. Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
  215. call plug#end()
  216. Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'