vim-plug/test/regressions.vader

305 lines
8.9 KiB
Plaintext
Raw Normal View History

**********************************************************************
Execute (#112 On-demand loading should not suppress messages from ftplugin):
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') >= 0
* The same applies to plug#load())
redir => out
call plug#load('ftplugin-msg')
redir END
Assert stridx(out, 'ftplugin') >= 0
q
**********************************************************************
Execute (#114 Should not contain empty path in &rtp):
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/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()
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
call plug#end()
PlugInstall | q
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()
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/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):
2015-05-28 09:07:31 -07:00
call plug#begin('/proc/no-permission')
Plug 'junegunn/vim-emoji'
call plug#end()
redir => out
silent PlugInstall
redir END
2015-05-28 09:07:31 -07:00
Assert out =~ 'Invalid plug directory: /proc/no-permission', out
**********************************************************************
Execute (#139-1 Using new remote branch):
" Make sure to remove the clone
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
call plug#end()
PlugClean!
" Install master branch
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
Plug expand('file:////tmp/new-branch')
call plug#end()
PlugUpdate
unlet! g:foo g:bar g:baz
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 not be found'
" Create a new branch on origin
2015-05-28 03:03:49 -07:00
call system('cd /tmp/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
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
Plug 'junegunn/seoul256.vim'
2015-05-28 03:03:49 -07:00
Plug expand('file:////tmp/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 plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found'
Assert exists('g:bar'), 'g:bar should be found'
Assert !exists('g:baz'), 'g:baz should not be found'
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
2015-05-28 03:03:49 -07:00
call system('cd /tmp/new-branch && git checkout master &&'
\. 'git checkout -b brand-new &&'
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
2015-01-08 08:56:52 -07:00
\. 'git commit -m third')
" Test Vim installer here
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
Plug expand('file:////tmp/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 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).
[=]
2015-01-08 08:56:52 -07:00
Execute (#139-3 Should fail when not possible to fast-forward):
" Commit on cloned repo
2015-05-28 03:03:49 -07:00
call system('cd /tmp/plugged/new-branch && git checkout master &&'
2015-01-08 08:56:52 -07:00
\. 'touch foobar && git add foobar && git commit -m foobar')
" Different commit on remote
2015-05-28 03:03:49 -07:00
call system('cd /tmp/new-branch && git checkout master &&'
2015-01-08 08:56:52 -07:00
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
for multi in [0, 1]
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
2015-01-08 08:56:52 -07:00
if multi
Plug 'junegunn/seoul256.vim'
endif
2015-05-28 03:03:49 -07:00
Plug expand('file:////tmp/new-branch')
2015-01-08 08:56:52 -07:00
call plug#end()
PlugUpdate
silent %y
Assert @" =~ 'Not possible to fast-forward', @"
endfor
2015-04-28 21:16:05 -07:00
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
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/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):
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plug it')
Plug 'seoul256 vim'
call plug#end()
Log &rtp
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
**********************************************************************
Execute (#184: Duplicate entries in &rtp):
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
Plug 'plugin1'
\| Plug 'plugin0'
Plug 'plugin2'
\| Plug 'plugin0'
\| Plug 'plugin1'
call plug#end()
Log &rtp
2015-02-25 06:44:18 -07:00
AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
2015-05-27 20:50:41 -07:00
**********************************************************************
Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
unlet! g:loaded_easy_align_plugin
silent! delc EasyAlign
call ReloadPlug()
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
2015-05-27 20:50:41 -07:00
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'
2015-05-28 03:03:49 -07:00
call plug#begin('/tmp/plugged')
2015-05-27 20:50:41 -07:00
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/plugged')
call plug#end()
PlugClean!
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
call plug#begin('/tmp/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/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/plugged')
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
call plug#end()
PlugInstall
q
tabnew /tmp/any.rs
AssertEqual 'rust', &filetype
Log &filetype
filetype detect
AssertEqual 'rust', &filetype
Log &filetype
bd