regressions.vader 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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('$TMPDIR/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 plug#begin('$TMPDIR/plugged')
  31. Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
  32. call plug#end()
  33. PlugInstall | q
  34. Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
  35. Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
  36. Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
  37. silent! EmojiCommand
  38. Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
  39. Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
  40. Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
  41. " Cleared on FileType
  42. call plug#begin('$TMPDIR/plugged')
  43. Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
  44. call plug#end()
  45. Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
  46. Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
  47. setf emoji
  48. Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
  49. Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
  50. **********************************************************************
  51. Execute (#131 Syntax error):
  52. call plug#begin('/no-permission')
  53. Plug 'junegunn/vim-emoji'
  54. call plug#end()
  55. redir => out
  56. silent PlugInstall
  57. redir END
  58. Assert out =~ 'Invalid plug directory: /no-permission'
  59. **********************************************************************
  60. Execute (#139-1 Using new remote branch):
  61. " Make sure to remove the clone
  62. call plug#begin('$TMPDIR/plugged')
  63. call plug#end()
  64. PlugClean!
  65. " Install master branch
  66. call plug#begin('$TMPDIR/plugged')
  67. Plug expand('file:///$TMPDIR/new-branch')
  68. call plug#end()
  69. PlugUpdate
  70. unlet! g:foo g:bar g:baz
  71. call plug#load('new-branch')
  72. Assert exists('g:foo'), 'g:foo should be found'
  73. Assert !exists('g:bar'), 'g:bar should not be found'
  74. Assert !exists('g:baz'), 'g:baz should not be found'
  75. " Create a new branch on origin
  76. call system('cd $TMPDIR/new-branch && git checkout -b new &&'
  77. \. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
  78. \. 'git commit -m second')
  79. " We're setting up two plugins so that parallel installer is used
  80. call plug#begin('$TMPDIR/plugged')
  81. Plug 'junegunn/seoul256.vim'
  82. Plug expand('file:///$TMPDIR/new-branch'), 'new'
  83. call plug#end()
  84. PlugUpdate
  85. silent %y
  86. Log @"
  87. Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
  88. unlet! g:foo g:bar g:baz
  89. call plug#load('new-branch')
  90. Assert exists('g:foo'), 'g:foo should be found'
  91. Assert exists('g:bar'), 'g:bar should be found'
  92. Assert !exists('g:baz'), 'g:baz should not be found'
  93. call PlugStatusSorted()
  94. Expect:
  95. - new-branch: OK
  96. - seoul256.vim: OK
  97. Finished. 0 error(s).
  98. [==]
  99. Execute (#139-2 Using yet another new remote branch):
  100. " Create another branch on origin
  101. call system('cd $TMPDIR/new-branch && git checkout master &&'
  102. \. 'git checkout -b brand-new &&'
  103. \. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
  104. \. 'git commit -m third')
  105. " Test Vim installer here
  106. call plug#begin('$TMPDIR/plugged')
  107. Plug expand('file:///$TMPDIR/new-branch'), 'brand-new'
  108. call plug#end()
  109. PlugUpdate
  110. silent %y
  111. Log @"
  112. Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
  113. unlet! g:foo g:bar g:baz
  114. call plug#load('new-branch')
  115. Assert exists('g:foo'), 'g:foo should be found'
  116. Assert !exists('g:bar'), 'g:bar should not be found'
  117. Assert exists('g:baz'), 'g:baz should be found'
  118. call PlugStatusSorted()
  119. Expect:
  120. - new-branch: OK
  121. Finished. 0 error(s).
  122. [=]
  123. Execute (#139-3 Should fail when not possible to fast-forward):
  124. " Commit on cloned repo
  125. call system('cd $TMPDIR/plugged/new-branch && git checkout master &&'
  126. \. 'touch foobar && git add foobar && git commit -m foobar')
  127. " Different commit on remote
  128. call system('cd $TMPDIR/new-branch && git checkout master &&'
  129. \. 'touch foobaz && git add foobaz && git commit -m foobaz')
  130. for multi in [0, 1]
  131. call plug#begin('$TMPDIR/plugged')
  132. if multi
  133. Plug 'junegunn/seoul256.vim'
  134. endif
  135. Plug expand('file:///$TMPDIR/new-branch')
  136. call plug#end()
  137. PlugUpdate
  138. silent %y
  139. Assert @" =~ 'Not possible to fast-forward', @"
  140. endfor
  141. **********************************************************************
  142. Execute (#145: Merging on-demand loading triggers - cmd):
  143. unlet! g:xxx g:yyy
  144. call plug#begin()
  145. Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
  146. Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
  147. call plug#end()
  148. silent! XXX
  149. Assert exists('g:xxx'), 'xxx is not loaded'
  150. Assert exists('g:yyy'), 'yyy is not loaded'
  151. Assert !exists(':YYY')
  152. Execute (#145: Merging on-demand loading triggers - map):
  153. unlet! g:xxx g:yyy
  154. call plug#begin()
  155. Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
  156. Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
  157. call plug#end()
  158. Assert !empty(mapcheck("<Plug>(xxx)"))
  159. Assert !empty(mapcheck("<Plug>(yyy)"))
  160. # FIXME feedkeys() cannot be tested with Vader
  161. call plug#load('xxx', 'yyy')
  162. Assert empty(mapcheck("<Plug>(xxx)"))
  163. Assert empty(mapcheck("<Plug>(yyy)"))
  164. **********************************************************************
  165. Execute (#159: shell=/bin/tcsh):
  166. let org = &shell
  167. try
  168. set shell=/bin/tcsh
  169. call plug#begin('$TMPDIR/plugged')
  170. Plug 'junegunn/seoul256.vim'
  171. call plug#end()
  172. PlugStatus
  173. Log getline(1, '$')
  174. q
  175. AssertEqual '/bin/tcsh', &shell
  176. finally
  177. let &shell = org
  178. endtry