2014-01-18 16:06:23 +01:00
|
|
|
Execute (plug#end() before plug#begin() should fail):
|
2014-07-28 12:50:09 +02:00
|
|
|
redir => out
|
2015-01-07 12:14:48 +01:00
|
|
|
silent! AssertEqual 0, plug#end()
|
2014-07-28 12:50:09 +02:00
|
|
|
redir END
|
|
|
|
Assert stridx(out, 'Call plug#begin() first') >= 0
|
2014-01-18 16:06:23 +01:00
|
|
|
|
2013-10-14 05:51:53 +02:00
|
|
|
Execute (plug#begin() without path argument):
|
|
|
|
call plug#begin()
|
|
|
|
AssertEqual split(&rtp, ',')[0].'/plugged', g:plug_home
|
|
|
|
unlet g:plug_home
|
|
|
|
|
2014-01-18 16:06:23 +01:00
|
|
|
Execute (plug#begin() without path argument with empty &rtp):
|
|
|
|
let save_rtp = &rtp
|
|
|
|
set rtp=
|
2014-07-28 12:50:09 +02:00
|
|
|
redir => out
|
|
|
|
AssertEqual 0, plug#begin()
|
|
|
|
redir END
|
|
|
|
Assert stridx(out, 'Unable to determine plug home') >= 0
|
2014-01-18 16:06:23 +01:00
|
|
|
let &rtp = save_rtp
|
|
|
|
|
2013-10-14 05:51:53 +02:00
|
|
|
Execute (plug#begin(path)):
|
2013-10-13 20:24:00 +02:00
|
|
|
let temp_plugged = tempname()
|
2013-10-14 05:51:53 +02:00
|
|
|
call plug#begin(temp_plugged.'/')
|
|
|
|
Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
AssertEqual 0, len(g:plugs)
|
|
|
|
AssertEqual temp_plugged, g:plug_home
|
|
|
|
AssertEqual basertp, &rtp
|
|
|
|
|
2013-10-14 05:51:53 +02:00
|
|
|
Execute (Subsequent plug#begin() calls will reuse g:plug_home):
|
|
|
|
call plug#begin()
|
|
|
|
AssertEqual temp_plugged, g:plug_home
|
|
|
|
|
|
|
|
Execute (Test Plug command):
|
2015-02-18 08:47:32 +01:00
|
|
|
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
|
2014-07-16 12:52:58 +02:00
|
|
|
Plug 'junegunn/seoul256.vim', 'yes-t_co'
|
2015-01-07 12:14:48 +01:00
|
|
|
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
|
2013-10-13 20:24:00 +02:00
|
|
|
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
2014-07-16 12:52:58 +02:00
|
|
|
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
|
|
|
|
|
|
|
|
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
|
2013-10-13 20:24:00 +02:00
|
|
|
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
|
|
|
|
|
2015-02-18 08:47:32 +01:00
|
|
|
^ Git repo with tag (DEPRECATED. USE TAG OPTION)
|
2014-07-16 12:52:58 +02:00
|
|
|
Plug 'junegunn/goyo.vim', '1.5.2'
|
2015-01-07 12:14:48 +01:00
|
|
|
AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
|
2014-06-23 05:22:25 +02:00
|
|
|
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
2014-07-16 12:52:58 +02:00
|
|
|
AssertEqual '1.5.2', g:plugs['goyo.vim'].branch
|
|
|
|
|
|
|
|
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
|
2015-02-18 08:47:32 +01:00
|
|
|
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
|
2014-06-23 05:22:25 +02:00
|
|
|
|
2013-10-13 20:24:00 +02:00
|
|
|
" Git URI
|
2015-01-07 12:14:48 +01:00
|
|
|
Plug 'file:///tmp/jg/vim-emoji'
|
|
|
|
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
|
2013-10-13 20:24:00 +02:00
|
|
|
AssertEqual 'master', g:plugs['vim-emoji'].branch
|
|
|
|
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
|
|
|
|
|
|
|
" vim-scripts/
|
|
|
|
Plug 'beauty256'
|
2015-01-07 12:14:48 +01:00
|
|
|
AssertEqual 'file:///tmp/vim-scripts/beauty256', g:plugs.beauty256.uri
|
2013-10-13 20:24:00 +02:00
|
|
|
AssertEqual 'master', g:plugs.beauty256.branch
|
|
|
|
|
2014-06-23 05:22:25 +02:00
|
|
|
AssertEqual 4, len(g:plugs)
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
Execute (Plug command with dictionary option):
|
2014-06-23 05:22:25 +02:00
|
|
|
Log string(g:plugs)
|
2013-10-13 20:24:00 +02:00
|
|
|
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
|
|
|
|
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
|
|
|
AssertEqual '././', g:plugs['seoul256.vim'].rtp
|
|
|
|
|
2014-06-23 05:22:25 +02:00
|
|
|
Log string(g:plugs)
|
|
|
|
AssertEqual 4, len(g:plugs)
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
Execute (PlugStatus before installation):
|
|
|
|
PlugStatus
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'Not found', 4
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugClean before installation):
|
|
|
|
PlugClean
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'Already clean', 1
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (plug#end() updates &rtp):
|
|
|
|
call plug#end()
|
|
|
|
Assert len(&rtp) > len(basertp)
|
2014-07-16 13:26:42 +02:00
|
|
|
AssertEqual first_rtp, split(&rtp, ',')[0]
|
|
|
|
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
Execute (Yet, plugins are not available):
|
|
|
|
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
|
|
|
|
|
|
|
Execute (PlugInstall):
|
|
|
|
PlugInstall
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Plugin available after installation):
|
|
|
|
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
|
|
|
|
|
|
|
Execute (PlugClean after installation):
|
|
|
|
PlugClean
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'Already clean', 1
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugStatus after installation):
|
|
|
|
PlugStatus
|
2014-07-22 05:46:59 +02:00
|
|
|
Log getline(1, '$')
|
|
|
|
AssertExpect 'OK', 4
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
2015-02-18 08:47:32 +01:00
|
|
|
Execute (PlugUpdate - tagged plugin should not fail (#174)):
|
|
|
|
PlugUpdate goyo.vim
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertExpect '^- goyo.vim', 1
|
|
|
|
q
|
|
|
|
|
2014-06-23 05:22:25 +02:00
|
|
|
Execute (Change tag of goyo.vim):
|
2015-02-18 08:47:32 +01:00
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/goyo.vim', { 'tag': '9.9.9' }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Execute (PlugStatus):
|
|
|
|
call PlugStatusSorted()
|
|
|
|
|
|
|
|
Expect:
|
|
|
|
Invalid tag: 1.5.3 (expected: 9.9.9). Try PlugUpdate.
|
|
|
|
Finished. 1 error(s).
|
|
|
|
[=]
|
|
|
|
x goyo.vim:
|
|
|
|
|
|
|
|
Execute (Remove tag of goyo.vim):
|
2014-06-23 05:22:25 +02:00
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/goyo.vim'
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Execute (PlugStatus):
|
|
|
|
call PlugStatusSorted()
|
|
|
|
|
|
|
|
Expect:
|
2015-02-18 08:47:32 +01:00
|
|
|
Invalid branch: HEAD (expected: master). Try PlugUpdate.
|
2014-06-23 05:22:25 +02:00
|
|
|
Finished. 1 error(s).
|
|
|
|
[=]
|
|
|
|
x goyo.vim:
|
|
|
|
|
|
|
|
Execute (PlugUpdate to set the right branch):
|
|
|
|
PlugUpdate
|
|
|
|
call PlugStatusSorted()
|
|
|
|
|
|
|
|
Expect:
|
|
|
|
- goyo.vim: OK
|
|
|
|
Finished. 0 error(s).
|
|
|
|
[=]
|
|
|
|
|
2013-10-13 20:24:00 +02:00
|
|
|
Execute (Change branch of seoul256.vim):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/seoul256.vim'
|
2015-01-07 12:14:48 +01:00
|
|
|
Plug 'file:///tmp/jg/vim-emoji'
|
2013-10-13 20:24:00 +02:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Execute (PlugStatus):
|
2014-06-23 05:22:25 +02:00
|
|
|
call PlugStatusSorted()
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
Expect:
|
2015-02-18 08:47:32 +01:00
|
|
|
Invalid branch: no-t_co (expected: master). Try PlugUpdate.
|
2013-10-13 20:24:00 +02:00
|
|
|
- vim-emoji: OK
|
|
|
|
Finished. 1 error(s).
|
2014-04-08 14:47:57 +02:00
|
|
|
[==]
|
2014-01-06 05:04:38 +01:00
|
|
|
x seoul256.vim:
|
|
|
|
|
2015-02-18 08:47:32 +01:00
|
|
|
Execute (PlugUpdate to switch branch, then PlugStatus):
|
|
|
|
PlugUpdate
|
|
|
|
call PlugStatusSorted()
|
|
|
|
|
|
|
|
Expect:
|
|
|
|
- seoul256.vim: OK
|
|
|
|
- vim-emoji: OK
|
|
|
|
Finished. 0 error(s).
|
|
|
|
[==]
|
|
|
|
|
|
|
|
Execute (Change tag of seoul256.vim):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/seoul256.vim', { 'tag': 'no-such-tag' }
|
|
|
|
call plug#end()
|
|
|
|
call PlugStatusSorted()
|
|
|
|
|
|
|
|
Expect:
|
|
|
|
Invalid tag: N/A (expected: no-such-tag). Try PlugUpdate.
|
|
|
|
Finished. 1 error(s).
|
|
|
|
[=]
|
|
|
|
x seoul256.vim:
|
|
|
|
|
2014-01-06 05:04:38 +01:00
|
|
|
Execute (Change URI of seoul256.vim):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn.choi/seoul256.vim'
|
2015-01-07 12:14:48 +01:00
|
|
|
Plug 'file:///tmp/jg/vim-emoji'
|
2014-01-06 05:04:38 +01:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Execute (PlugStatus):
|
2014-06-23 05:22:25 +02:00
|
|
|
call PlugStatusSorted()
|
2014-01-06 05:04:38 +01:00
|
|
|
|
|
|
|
Expect:
|
2015-01-07 12:14:48 +01:00
|
|
|
Expected: file:///tmp/junegunn.choi/seoul256.vim
|
|
|
|
Invalid URI: file:///tmp/junegunn/seoul256.vim
|
2014-01-06 05:04:38 +01:00
|
|
|
PlugClean required.
|
|
|
|
- vim-emoji: OK
|
|
|
|
Finished. 1 error(s).
|
2014-04-08 14:47:57 +02:00
|
|
|
[==]
|
2014-01-06 05:04:38 +01:00
|
|
|
x seoul256.vim:
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
# TODO: does not work due to inputsave()
|
|
|
|
# Do (PlugClean):
|
|
|
|
# :PlugClean\<Enter>y\<Enter>
|
|
|
|
# ggyG
|
|
|
|
# q
|
|
|
|
# PGdd
|
|
|
|
|
|
|
|
Execute (PlugClean! to remove seoul256.vim):
|
|
|
|
PlugClean!
|
2014-06-23 05:22:25 +02:00
|
|
|
" Three removed, emoji left
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect '^- ', 3
|
|
|
|
AssertExpect 'Removed', 1
|
2013-10-14 05:51:53 +02:00
|
|
|
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
|
|
|
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Change GIT URI of vim-emoji):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/seoul256.vim'
|
|
|
|
Plug 'junegunn/vim-emoji'
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Execute (PlugStatus):
|
2014-06-23 05:22:25 +02:00
|
|
|
call PlugStatusSorted()
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
Expect:
|
2015-01-07 12:14:48 +01:00
|
|
|
Expected: file:///tmp/junegunn/vim-emoji
|
|
|
|
Invalid URI: file:///tmp/jg/vim-emoji
|
2014-01-06 05:04:38 +01:00
|
|
|
Not found. Try PlugInstall.
|
|
|
|
PlugClean required.
|
2013-10-13 20:24:00 +02:00
|
|
|
Finished. 2 error(s).
|
2014-04-08 14:47:57 +02:00
|
|
|
[==]
|
2014-01-06 05:04:38 +01:00
|
|
|
x seoul256.vim:
|
|
|
|
x vim-emoji:
|
2013-10-13 20:24:00 +02:00
|
|
|
|
|
|
|
Execute (PlugClean! to remove vim-emoji):
|
|
|
|
PlugClean!
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect '^- ', 1
|
|
|
|
AssertExpect 'Removed', 1
|
2013-10-14 05:51:53 +02:00
|
|
|
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
|
|
|
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugUpdate to install both again):
|
|
|
|
PlugUpdate
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect '^- [^:]*:', 2
|
2013-10-14 05:51:53 +02:00
|
|
|
Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
|
|
|
|
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
2014-04-14 14:20:21 +02:00
|
|
|
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
|
2013-10-13 20:24:00 +02:00
|
|
|
PlugUpdate
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'Already up-to-date', 2
|
2014-04-14 14:20:21 +02:00
|
|
|
normal D
|
|
|
|
AssertEqual 'No updates.', getline(1)
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugDiff - 'No updates.'):
|
|
|
|
PlugDiff
|
|
|
|
AssertEqual 'No updates.', getline(1)
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
|
|
|
for repo in ['seoul256.vim', 'vim-emoji']
|
|
|
|
call system(printf('cd %s/%s && git reset HEAD^^ --hard', g:plug_home, repo))
|
|
|
|
endfor
|
|
|
|
PlugUpdate
|
|
|
|
|
|
|
|
" Now we have updates
|
|
|
|
normal D
|
|
|
|
AssertEqual 'Last update:', getline(1)
|
|
|
|
|
|
|
|
" Preview commit
|
|
|
|
silent! wincmd P
|
|
|
|
AssertEqual 0, &previewwindow
|
|
|
|
|
|
|
|
" ]] motion
|
|
|
|
execute 'normal ]]'
|
|
|
|
let lnum = line('.')
|
|
|
|
AssertEqual 3, col('.')
|
|
|
|
|
|
|
|
" Open commit preview
|
|
|
|
execute "normal j\<cr>"
|
|
|
|
wincmd P
|
|
|
|
AssertEqual 1, &previewwindow
|
|
|
|
AssertEqual 'git', &filetype
|
|
|
|
|
|
|
|
" Back to plug window
|
|
|
|
wincmd p
|
|
|
|
|
|
|
|
" ]] motion
|
|
|
|
execute 'normal $]]'
|
2014-12-13 03:51:37 +01:00
|
|
|
Assert line('.') >= 4
|
|
|
|
" 5+ for merge commit
|
2014-04-14 14:20:21 +02:00
|
|
|
AssertEqual 3, col('.')
|
|
|
|
|
|
|
|
" [[ motion
|
|
|
|
execute 'normal 0[['
|
|
|
|
AssertEqual lnum, line('.')
|
|
|
|
AssertEqual 3, col('.')
|
|
|
|
|
2014-08-10 09:32:46 +02:00
|
|
|
" X key to revert the update
|
|
|
|
AssertExpect '^- ', 2
|
|
|
|
execute "normal Xn\<cr>"
|
|
|
|
AssertExpect '^- ', 2
|
|
|
|
execute "normal Xy\<cr>"
|
|
|
|
AssertExpect '^- ', 1
|
|
|
|
|
2014-04-14 14:20:21 +02:00
|
|
|
" q will close preview window as well
|
|
|
|
normal q
|
|
|
|
|
|
|
|
" We no longer have preview window
|
|
|
|
silent! wincmd P
|
|
|
|
AssertEqual 0, &previewwindow
|
|
|
|
|
|
|
|
" q should not close preview window if it's already open
|
|
|
|
pedit
|
|
|
|
PlugDiff
|
2014-08-10 09:32:46 +02:00
|
|
|
AssertExpect '^- ', 1
|
2014-04-14 14:20:21 +02:00
|
|
|
execute "normal ]]j\<cr>"
|
|
|
|
normal q
|
|
|
|
|
|
|
|
silent! wincmd P
|
|
|
|
AssertEqual 1, &previewwindow
|
|
|
|
pclose
|
|
|
|
|
2014-10-10 03:54:00 +02:00
|
|
|
Execute (Reuse Plug window in another tab):
|
|
|
|
let tabnr = tabpagenr()
|
2014-04-14 14:20:21 +02:00
|
|
|
PlugDiff
|
|
|
|
tab new new-tab
|
|
|
|
set buftype=nofile
|
|
|
|
PlugUpdate
|
|
|
|
normal D
|
2014-08-10 09:32:46 +02:00
|
|
|
AssertExpect '^- ', 1
|
|
|
|
normal q
|
2014-10-10 03:54:00 +02:00
|
|
|
AssertEqual tabnr, tabpagenr()
|
|
|
|
normal! gt
|
2013-10-13 20:24:00 +02:00
|
|
|
q
|
|
|
|
|
2014-06-20 13:53:57 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ On-demand loading / Partial installation/update ~
|
|
|
|
**********************************************************************
|
|
|
|
|
|
|
|
Execute (Trying to execute on-demand commands when plugin is not installed):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Assert exists(':EasyAlign')
|
|
|
|
Assert exists(':LiveEasyAlign')
|
|
|
|
AssertThrows EasyAlign
|
|
|
|
AssertThrows LiveEasyAlign
|
|
|
|
Assert !exists(':EasyAlign')
|
|
|
|
Assert !exists(':LiveEasyAlign')
|
|
|
|
|
|
|
|
Execute (New set of plugins):
|
|
|
|
call plug#begin()
|
2014-07-30 12:52:19 +02:00
|
|
|
Plug 'junegunn/vim-fnr'
|
|
|
|
Plug 'junegunn/vim-pseudocl'
|
2014-06-20 13:53:57 +02:00
|
|
|
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
|
|
|
Plug 'junegunn/vim-redis', { 'for': 'redis' }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Execute (Check commands):
|
|
|
|
Assert !exists(':FNR'), 'FNR command should not be found'
|
|
|
|
Assert !exists(':RedisExecute'), 'RedisExecute command should not be found'
|
|
|
|
|
|
|
|
Execute (Partial PlugInstall):
|
|
|
|
PlugInstall vim-fnr vim-easy-align
|
2014-07-30 12:52:19 +02:00
|
|
|
AssertExpect 'vim-fnr', 1
|
2014-06-20 13:53:57 +02:00
|
|
|
q
|
|
|
|
|
2014-07-30 12:52:19 +02:00
|
|
|
PlugInstall vim-fnr vim-easy-align 1
|
|
|
|
AssertExpect 'vim-fnr', 1
|
|
|
|
AssertExpect 'vim-easy-align', 1
|
2014-07-16 13:26:42 +02:00
|
|
|
AssertEqual first_rtp, split(&rtp, ',')[0]
|
|
|
|
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
2014-07-30 12:52:19 +02:00
|
|
|
q
|
2014-06-20 14:27:46 +02:00
|
|
|
|
2014-06-20 13:53:57 +02:00
|
|
|
Given (Unaligned code):
|
|
|
|
a=1
|
|
|
|
aa=2
|
|
|
|
|
|
|
|
Execute (Check installed plugins):
|
2014-09-22 17:21:48 +02:00
|
|
|
call EnsureLoaded()
|
2014-06-20 13:53:57 +02:00
|
|
|
Assert exists(':FNR'), 'FNR command should be found'
|
|
|
|
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
|
2014-07-31 09:34:41 +02:00
|
|
|
|
|
|
|
Assert exists(':EasyAlign'), 'EasyAlign command should be found'
|
2014-06-20 13:53:57 +02:00
|
|
|
%EasyAlign=
|
|
|
|
|
|
|
|
Expect (Aligned code):
|
|
|
|
a = 1
|
|
|
|
aa = 2
|
|
|
|
|
2014-07-26 15:49:18 +02:00
|
|
|
Given:
|
2014-06-20 13:53:57 +02:00
|
|
|
Execute (Partial PlugUpdate):
|
|
|
|
PlugUpdate vim-redis
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (On-demand loading based on filetypes):
|
|
|
|
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
|
|
|
|
set ft=redis
|
|
|
|
Assert exists(':RedisExecute'), 'RedisExecute command is now found'
|
|
|
|
|
2014-07-16 12:52:58 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ Local (unmanaged) plugins
|
|
|
|
**********************************************************************
|
|
|
|
|
|
|
|
Execute (Add unmanaged plugin):
|
2014-10-19 07:45:19 +02:00
|
|
|
let fzf = expand('$PLUG_FIXTURES/fzf')
|
2014-07-16 12:52:58 +02:00
|
|
|
Log fzf
|
|
|
|
|
|
|
|
call plug#begin()
|
|
|
|
Plug fzf, { 'on': 'SomeCommand' }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" Check uri field
|
|
|
|
Assert !has_key(g:plugs.fzf, 'uri'), 'Should not have uri field'
|
|
|
|
|
|
|
|
" Check dir field
|
|
|
|
AssertEqual fzf.'/', g:plugs.fzf.dir
|
|
|
|
|
|
|
|
" Trailing slashes and backslashes should be stripped
|
|
|
|
for suffix in ['///', '/\/\/']
|
|
|
|
call plug#begin()
|
|
|
|
Plug fzf.suffix, { 'on': 'SomeCommand' }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" Check dir field
|
|
|
|
AssertEqual fzf.'/', g:plugs.fzf.dir
|
|
|
|
endfor
|
|
|
|
|
|
|
|
Execute (Plug block for following tests):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align'
|
|
|
|
Plug fzf, { 'on': 'SomeCommand' }
|
|
|
|
call plug#end()
|
|
|
|
" Remove plugins from previous tests
|
|
|
|
PlugClean!
|
2014-11-20 17:06:17 +01:00
|
|
|
q
|
2014-07-16 12:52:58 +02:00
|
|
|
|
|
|
|
Execute (PlugInstall will only install vim-easy-align):
|
|
|
|
PlugInstall
|
|
|
|
Log getline(1, '$')
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'fzf', 0
|
2014-07-16 12:52:58 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugUpdate will only update vim-easy-align):
|
|
|
|
PlugUpdate
|
|
|
|
Log getline(1, '$')
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'fzf', 0
|
2014-07-16 12:52:58 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugClean should not care about unmanaged plugins):
|
|
|
|
PlugClean
|
|
|
|
Log getline(1, '$')
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'fzf', 0
|
2014-07-16 12:52:58 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugStatus should point out that the plugin is missing):
|
|
|
|
PlugStatus
|
|
|
|
Log getline(1, '$')
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'x fzf', 1
|
|
|
|
AssertExpect 'Not found', 1
|
2014-07-16 12:52:58 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Deploy unmanaged plugin):
|
|
|
|
Assert !exists(':FZF'), ':FZF command should not exist'
|
2014-10-19 07:45:19 +02:00
|
|
|
call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf)
|
2014-07-16 12:52:58 +02:00
|
|
|
|
|
|
|
Execute (PlugUpdate still should not care):
|
|
|
|
PlugUpdate
|
|
|
|
Log getline(1, '$')
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'fzf', 0
|
2014-07-16 12:52:58 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugStatus with no error):
|
|
|
|
PlugStatus
|
|
|
|
Log getline(1, '$')
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect 'x fzf', 0
|
|
|
|
AssertExpect 'Not found', 0
|
2014-07-16 12:52:58 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Check &rtp after SomeCommand):
|
|
|
|
Log &rtp
|
|
|
|
Assert &rtp !~ 'fzf'
|
|
|
|
silent! SomeCommand
|
|
|
|
Assert &rtp =~ 'fzf'
|
2014-07-16 13:26:42 +02:00
|
|
|
AssertEqual first_rtp, split(&rtp, ',')[0]
|
|
|
|
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
2014-07-16 12:52:58 +02:00
|
|
|
|
|
|
|
Execute (Common parent):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-pseudocl'
|
|
|
|
Plug 'junegunn/vim-fnr'
|
|
|
|
Plug 'junegunn/vim-oblique'
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
PlugInstall
|
|
|
|
Log getline(1, '$')
|
2014-07-22 05:46:59 +02:00
|
|
|
AssertExpect! '[===]', 1
|
2014-07-16 12:52:58 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
**********************************************************************
|
|
|
|
~ Frozen plugins
|
|
|
|
**********************************************************************
|
2014-10-22 06:02:17 +02:00
|
|
|
- We've decided to install plugins that are frozen: see #113
|
|
|
|
Execute (Frozen plugin are not ~~installed nor~~ updated):
|
|
|
|
" Remove plugins
|
|
|
|
call plug#begin()
|
|
|
|
call plug#end()
|
|
|
|
PlugClean!
|
|
|
|
q
|
2014-07-16 12:52:58 +02:00
|
|
|
|
2014-10-22 06:02:17 +02:00
|
|
|
" vim-easy-align is not found, so it will be installed even though it's frozen
|
2014-07-16 12:52:58 +02:00
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
|
|
|
call plug#end()
|
2014-10-22 06:02:17 +02:00
|
|
|
PlugInstall
|
|
|
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
|
|
|
q
|
|
|
|
|
|
|
|
" Remove plugins again
|
|
|
|
call plug#begin()
|
|
|
|
call plug#end()
|
|
|
|
PlugClean!
|
|
|
|
q
|
|
|
|
|
|
|
|
" PlugUpdate will do the same
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
|
|
|
call plug#end()
|
|
|
|
PlugInstall
|
|
|
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
|
|
|
q
|
2014-07-16 12:52:58 +02:00
|
|
|
|
2014-10-22 06:02:17 +02:00
|
|
|
" Since vim-easy-align already exists, PlugInstall or PlugUpdate will skip it
|
2014-08-04 09:27:06 +02:00
|
|
|
redir => out
|
2014-07-16 12:52:58 +02:00
|
|
|
silent PlugInstall
|
|
|
|
redir END
|
2014-08-04 09:27:06 +02:00
|
|
|
Assert out =~ 'No plugin to install'
|
2014-07-16 12:52:58 +02:00
|
|
|
|
2014-08-04 09:27:06 +02:00
|
|
|
redir => out
|
2014-07-16 12:52:58 +02:00
|
|
|
silent PlugUpdate
|
|
|
|
redir END
|
2014-08-04 09:27:06 +02:00
|
|
|
Assert out =~ 'No plugin to update'
|
2014-07-16 12:52:58 +02:00
|
|
|
|
|
|
|
Execute (But you can still install it if the name is given as the argument):
|
|
|
|
PlugInstall vim-easy-align
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
|
|
|
q
|
|
|
|
|
|
|
|
PlugUpdate vim-easy-align
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
|
|
|
q
|
|
|
|
|
2014-07-22 05:46:59 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ Retry
|
|
|
|
**********************************************************************
|
|
|
|
|
|
|
|
Execute (Retry failed tasks):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align'
|
|
|
|
Plug 'junegunn/aaaaaaaaaaaaaa'
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
PlugInstall
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertExpect 'x aaa', 1
|
|
|
|
AssertExpect '- vim-easy-align', 1
|
|
|
|
normal R
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertExpect 'x aaa', 1
|
|
|
|
AssertExpect '- vim-easy-align', 0
|
|
|
|
AssertExpect! '[x]', 1
|
|
|
|
q
|
|
|
|
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align'
|
|
|
|
Plug 'junegunn/aaaaaaaaaaaaaa'
|
|
|
|
Plug 'junegunn/bbbbbbbbbbbbbb'
|
|
|
|
Plug 'junegunn/cccccccccccccc'
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" Ruby installer
|
|
|
|
PlugUpdate
|
|
|
|
normal R
|
|
|
|
AssertExpect '- vim-easy-align', 0
|
|
|
|
AssertExpect! '[xxx]', 1
|
|
|
|
q
|
|
|
|
|
|
|
|
" Vim installer
|
|
|
|
PlugUpdate 1
|
|
|
|
normal R
|
|
|
|
AssertExpect '- vim-easy-align', 0
|
|
|
|
AssertExpect! '[xxx]', 1
|
|
|
|
q
|
|
|
|
|
2014-07-26 15:49:18 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ Post-update hook (`do` option)
|
|
|
|
**********************************************************************
|
|
|
|
|
|
|
|
Execute (Cleanup):
|
|
|
|
call plug#begin()
|
|
|
|
call plug#end()
|
|
|
|
PlugClean!
|
2014-11-20 17:06:17 +01:00
|
|
|
q
|
2014-07-26 15:49:18 +02:00
|
|
|
|
|
|
|
Execute (On install):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
|
|
|
|
Plug 'junegunn/vim-pseudocl'
|
|
|
|
call plug#end()
|
|
|
|
|
2015-01-07 12:14:48 +01:00
|
|
|
silent PlugInstall
|
2014-07-26 15:49:18 +02:00
|
|
|
q
|
|
|
|
|
|
|
|
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed'),
|
|
|
|
\ 'vim-easy-align/installed should exist'
|
|
|
|
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'),
|
|
|
|
\ 'vim-pseudocl/installed should not exist'
|
|
|
|
|
|
|
|
Execute (On update):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' }
|
|
|
|
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" Reset for updates
|
|
|
|
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')
|
|
|
|
|
2015-01-07 12:14:48 +01:00
|
|
|
silent PlugUpdate
|
2014-07-26 15:49:18 +02:00
|
|
|
Log getline(1, '$')
|
|
|
|
q
|
|
|
|
|
|
|
|
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated'),
|
|
|
|
\ 'vim-easy-align/updated should not exist'
|
|
|
|
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated'),
|
|
|
|
\ 'vim-pseudocl/updated should exist'
|
|
|
|
|
|
|
|
Execute (When already installed):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' }
|
|
|
|
Plug 'junegunn/vim-pseudocl', { 'do': 'touch installed2' }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
PlugInstall
|
|
|
|
q
|
|
|
|
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
|
|
|
|
\ 'vim-easy-align/installed2 should not exist'
|
|
|
|
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'),
|
2014-08-02 05:13:52 +02:00
|
|
|
\ 'vim-pseudocl/installed2 should not exist'
|
|
|
|
|
|
|
|
Execute (PlugInstall!):
|
2015-01-07 12:14:48 +01:00
|
|
|
silent PlugInstall!
|
2014-08-02 05:13:52 +02:00
|
|
|
q
|
|
|
|
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
|
|
|
|
\ 'vim-easy-align/installed2 should exist'
|
|
|
|
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'),
|
2014-07-26 15:49:18 +02:00
|
|
|
\ 'vim-pseudocl/installed2 should exist'
|
|
|
|
|
|
|
|
Execute (When already updated):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' }
|
|
|
|
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated2' }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
PlugUpdate
|
|
|
|
q
|
|
|
|
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
|
|
|
|
\ 'vim-easy-align/updated2 should not exist'
|
|
|
|
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
|
2014-08-02 05:13:52 +02:00
|
|
|
\ 'vim-pseudocl/updated2 should not exist'
|
|
|
|
|
|
|
|
Execute (PlugUpdate!):
|
2015-01-07 12:14:48 +01:00
|
|
|
silent PlugUpdate!
|
2014-08-02 05:13:52 +02:00
|
|
|
q
|
|
|
|
Assert filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
|
|
|
|
\ 'vim-easy-align/updated2 should exist'
|
|
|
|
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
|
2014-07-26 15:49:18 +02:00
|
|
|
\ 'vim-pseudocl/updated2 should exist'
|
|
|
|
|
|
|
|
Execute (Using Funcref):
|
2014-07-27 04:28:53 +02:00
|
|
|
function! PlugUpdated(info)
|
2014-08-02 05:13:52 +02:00
|
|
|
call system('touch '. a:info.name . a:info.status . a:info.force . len(a:info))
|
2014-07-26 15:49:18 +02:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'do': function('PlugUpdated') }
|
|
|
|
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
|
|
|
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
|
|
|
|
|
|
|
PlugUpdate
|
|
|
|
Log getline(1, '$')
|
|
|
|
q
|
2014-08-02 05:13:52 +02:00
|
|
|
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated03'),
|
|
|
|
\ 'vim-easy-align/vim-easy-alignupdated03 should exist'
|
|
|
|
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'),
|
|
|
|
\ 'vim-pseudocl/vim-pseudoclinstalled03 should exist'
|
2014-07-26 15:49:18 +02:00
|
|
|
|
2014-08-02 05:13:52 +02:00
|
|
|
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
|
|
|
PlugInstall!
|
|
|
|
q
|
|
|
|
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'),
|
|
|
|
\ 'vim-easy-align/vim-easy-alignunchanged13 should exist'
|
|
|
|
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled13'),
|
|
|
|
\ 'vim-pseudocl/vim-pseudoclinstalled13 should exist'
|
|
|
|
|
|
|
|
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
|
|
|
PlugUpdate!
|
|
|
|
q
|
|
|
|
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated13'),
|
|
|
|
\ 'vim-easy-align/vim-easy-alignupdated13 should exist'
|
|
|
|
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'),
|
|
|
|
\ 'vim-pseudocl/vim-pseudoclunchanged13 should exist'
|
2014-07-30 12:20:51 +02:00
|
|
|
|
|
|
|
**********************************************************************
|
|
|
|
~ Overriding `dir`
|
|
|
|
**********************************************************************
|
|
|
|
|
|
|
|
Execute (Using custom dir):
|
|
|
|
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
|
|
|
|
2014-07-30 12:52:19 +02:00
|
|
|
call system('rm -rf '.$TMPDIR.'easy-align')
|
2014-07-30 12:20:51 +02:00
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align', { 'dir': $TMPDIR.'easy-align' }
|
|
|
|
call plug#end()
|
|
|
|
AssertEqual $TMPDIR.'easy-align/', g:plugs['vim-easy-align'].dir
|
|
|
|
|
|
|
|
PlugClean!
|
|
|
|
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
|
|
|
|
q
|
|
|
|
|
|
|
|
PlugInstall
|
|
|
|
q
|
|
|
|
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
|
|
|
|
2014-07-31 09:34:41 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ On-demand loading load order
|
|
|
|
**********************************************************************
|
|
|
|
Before (Clear global vars):
|
|
|
|
let g:xxx = []
|
2014-10-19 07:45:19 +02:00
|
|
|
set rtp-=$PLUG_FIXTURES/xxx/
|
|
|
|
set rtp-=$PLUG_FIXTURES/xxx/after
|
2013-10-13 20:24:00 +02:00
|
|
|
|
2014-07-31 09:34:41 +02:00
|
|
|
Execute (Immediate loading):
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/xxx'
|
2014-07-31 09:34:41 +02:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" FIXME:
|
|
|
|
" Different result when Vader is run from commandline with `-c` option
|
|
|
|
Log g:xxx
|
|
|
|
if has('vim_starting')
|
2014-09-22 17:21:48 +02:00
|
|
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
2014-07-31 09:34:41 +02:00
|
|
|
else
|
2014-09-22 17:21:48 +02:00
|
|
|
AssertEqual ['xxx/plugin', 'xxx/after/plugin', 'xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
2014-07-31 09:34:41 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
Execute (Command-based on-demand loading):
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
|
2014-07-31 09:34:41 +02:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
AssertEqual [], g:xxx
|
|
|
|
|
|
|
|
silent! XXX
|
2014-09-22 17:21:48 +02:00
|
|
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin'], g:xxx
|
2014-07-31 09:34:41 +02:00
|
|
|
|
|
|
|
setf xxx
|
2014-09-22 17:21:48 +02:00
|
|
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
|
2014-07-31 09:34:41 +02:00
|
|
|
|
|
|
|
Execute (Filetype-based on-demand loading):
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
|
2014-07-31 09:34:41 +02:00
|
|
|
call plug#end()
|
|
|
|
|
2014-09-22 17:21:48 +02:00
|
|
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
2014-07-31 09:34:41 +02:00
|
|
|
|
|
|
|
setf xxx
|
2014-09-22 17:21:48 +02:00
|
|
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
|
2014-07-31 09:34:41 +02:00
|
|
|
|
2014-08-10 06:08:48 +02:00
|
|
|
Before:
|
|
|
|
|
2014-08-09 05:02:03 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ plug#helptags()
|
|
|
|
**********************************************************************
|
|
|
|
|
|
|
|
Execute (plug#helptags):
|
2014-10-19 07:45:19 +02:00
|
|
|
silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
|
|
|
Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
2014-08-09 05:02:03 +02:00
|
|
|
AssertEqual 1, plug#helptags()
|
2014-10-19 07:45:19 +02:00
|
|
|
Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
2014-08-09 05:02:03 +02:00
|
|
|
|
2014-08-09 05:59:04 +02:00
|
|
|
**********************************************************************
|
2014-08-10 06:08:48 +02:00
|
|
|
~ Manual loading
|
2014-08-09 05:59:04 +02:00
|
|
|
**********************************************************************
|
|
|
|
|
|
|
|
Execute (plug#load - invalid arguments):
|
|
|
|
AssertEqual 0, plug#load()
|
|
|
|
AssertEqual 0, plug#load('non-existent-plugin')
|
|
|
|
AssertEqual 0, plug#load('non-existent-plugin', 'another-non-existent-plugin')
|
|
|
|
AssertEqual 1, plug#load('xxx')
|
|
|
|
AssertEqual 0, plug#load('xxx', 'non-existent-plugin')
|
|
|
|
AssertEqual 0, plug#load('non-existent-plugin', 'xxx')
|
|
|
|
|
2014-08-10 06:08:48 +02:00
|
|
|
Execute (on: []):
|
2014-08-09 05:59:04 +02:00
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/rust.vim', { 'on': [] }
|
|
|
|
call plug#end()
|
|
|
|
PlugInstall
|
|
|
|
q
|
|
|
|
|
2014-08-10 06:08:48 +02:00
|
|
|
Execute (PlugStatus reports (not loaded)):
|
|
|
|
PlugStatus
|
|
|
|
AssertExpect 'not loaded', 1
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (plug#load to load it):
|
2014-08-10 09:32:46 +02:00
|
|
|
tabnew test.rs
|
|
|
|
" Vader will switch tab to [Vader-workbench] after Log
|
|
|
|
" Log &filetype
|
2014-08-09 05:59:04 +02:00
|
|
|
AssertEqual 1, plug#load('rust.vim')
|
|
|
|
AssertEqual 'rust', &filetype
|
2014-08-10 09:32:46 +02:00
|
|
|
q
|
2014-08-09 05:59:04 +02:00
|
|
|
|
2014-08-10 06:08:48 +02:00
|
|
|
Execute (PlugStatus should not contain (not loaded)):
|
|
|
|
PlugStatus
|
|
|
|
AssertExpect 'not loaded', 0
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
|
2014-08-10 06:08:48 +02:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
PlugStatus
|
|
|
|
AssertExpect 'not loaded', 1
|
|
|
|
Assert !exists('g:yyy'), 'yyy not loaded'
|
|
|
|
/not loaded
|
|
|
|
normal L
|
|
|
|
AssertExpect 'not loaded', 0
|
|
|
|
Assert exists('g:yyy'), 'yyy loaded'
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Load plugin from PlugStatus screen with L key in visual mode):
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/z1', { 'on': [] }
|
|
|
|
Plug '$PLUG_FIXTURES/z2', { 'for': [] }
|
2014-08-10 06:08:48 +02:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
PlugStatus
|
|
|
|
AssertExpect 'not loaded', 2
|
|
|
|
Assert !exists('g:z1'), 'z1 not loaded'
|
|
|
|
Assert !exists('g:z2'), 'z2 not loaded'
|
|
|
|
normal ggVGL
|
|
|
|
AssertExpect 'not loaded', 0
|
|
|
|
Assert exists('g:z1'), 'z1 loaded'
|
|
|
|
Assert exists('g:z2'), 'z2 loaded'
|
|
|
|
q
|
|
|
|
|
2014-08-20 05:30:39 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ g:plug_window
|
|
|
|
**********************************************************************
|
|
|
|
Execute (Open plug window in a new tab):
|
|
|
|
" Without g:plug_window, plug window is open on the left split
|
|
|
|
let tabnr = tabpagenr()
|
|
|
|
PlugStatus
|
|
|
|
AssertEqual tabnr, tabpagenr()
|
|
|
|
AssertEqual 1, winnr()
|
|
|
|
|
|
|
|
" PlugStatus again inside the window should not change the view
|
|
|
|
normal S
|
|
|
|
AssertEqual tabnr, tabpagenr()
|
|
|
|
AssertEqual 1, winnr()
|
|
|
|
q
|
|
|
|
|
|
|
|
" Define g:plug_window so that plug window is open in a new tab
|
|
|
|
let g:plug_window = 'tabnew'
|
|
|
|
PlugStatus
|
|
|
|
AssertNotEqual tabnr, tabpagenr()
|
|
|
|
|
|
|
|
" PlugStatus again inside the window should not change the view
|
|
|
|
let tabnr = tabpagenr()
|
|
|
|
normal S
|
|
|
|
AssertEqual tabnr, tabpagenr()
|
|
|
|
q
|
2014-09-15 12:12:52 +02:00
|
|
|
unlet g:plug_window
|
2014-08-20 05:30:39 +02:00
|
|
|
|
2014-08-25 18:36:50 +02:00
|
|
|
**********************************************************************
|
|
|
|
~ g:plug_url_format
|
|
|
|
**********************************************************************
|
|
|
|
Execute (Using g:plug_url_format):
|
2015-01-07 12:14:48 +01:00
|
|
|
let prev_plug_url_format = g:plug_url_format
|
2014-08-25 18:36:50 +02:00
|
|
|
call plug#begin()
|
|
|
|
let g:plug_url_format = 'git@bitbucket.org:%s.git'
|
|
|
|
Plug 'junegunn/seoul256.vim'
|
|
|
|
let g:plug_url_format = 'git@bitsocket.org:%s.git'
|
|
|
|
Plug 'beauty256'
|
|
|
|
AssertEqual 'git@bitbucket.org:junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
|
|
|
|
AssertEqual 'git@bitsocket.org:vim-scripts/beauty256.git', g:plugs['beauty256'].uri
|
2015-01-07 12:14:48 +01:00
|
|
|
let g:plug_url_format = prev_plug_url_format
|
2014-09-15 12:12:52 +02:00
|
|
|
|
|
|
|
**********************************************************************
|
|
|
|
~ U
|
|
|
|
**********************************************************************
|
|
|
|
Execute (Plug block):
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'junegunn/vim-easy-align'
|
|
|
|
Plug 'junegunn/vim-emoji'
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
Execute (Update plugin with U key in normal mode):
|
|
|
|
PlugStatus
|
|
|
|
/emoji
|
|
|
|
normal U
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertExpect 'Updated', 1
|
|
|
|
AssertExpect 'vim-emoji', 1
|
|
|
|
AssertExpect 'vim-easy-align', 0
|
|
|
|
AssertExpect! '[=]', 1
|
|
|
|
|
|
|
|
" From PlugInstall screen
|
|
|
|
PlugInstall
|
|
|
|
/easy-align
|
|
|
|
normal U
|
|
|
|
AssertExpect 'Updated', 1
|
|
|
|
AssertExpect 'vim-emoji', 0
|
|
|
|
AssertExpect 'vim-easy-align', 1
|
|
|
|
AssertExpect! '[=]', 1
|
|
|
|
q
|
|
|
|
|
|
|
|
Execute (Update plugins with U key in visual mode):
|
|
|
|
silent! call system('rm -rf '.g:plugs['vim-easy-align'].dir)
|
|
|
|
|
|
|
|
PlugStatus
|
|
|
|
normal VGU
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertExpect 'Updated', 1
|
|
|
|
AssertExpect 'vim-emoji', 1
|
|
|
|
AssertExpect 'vim-easy-align', 1
|
|
|
|
AssertExpect! '[==]', 1
|
|
|
|
|
|
|
|
" From PlugUpdate screen
|
|
|
|
normal VGU
|
|
|
|
Log getline(1, '$')
|
|
|
|
AssertExpect 'Updated', 1
|
|
|
|
AssertExpect 'vim-emoji', 1
|
|
|
|
AssertExpect 'vim-easy-align', 1
|
|
|
|
AssertExpect! '[==]', 1
|
|
|
|
q
|
2014-08-25 18:36:50 +02:00
|
|
|
|
2014-09-22 17:21:48 +02:00
|
|
|
**********************************************************************
|
2014-09-17 12:41:00 +02:00
|
|
|
Execute (plug#begin should expand env vars):
|
|
|
|
AssertNotEqual '$HOME/.emacs/plugged', expand('$HOME/.emacs/plugged')
|
|
|
|
call plug#begin('$HOME/.emacs/plugged')
|
|
|
|
AssertEqual expand('$HOME/.emacs/plugged'), g:plug_home
|
|
|
|
|
2014-09-22 17:21:48 +02:00
|
|
|
**********************************************************************
|
|
|
|
Execute (Plug directory with comma):
|
|
|
|
call plug#begin(temp_plugged . '/p,l,u,g,g,e,d')
|
|
|
|
Plug 'junegunn/vim-emoji'
|
|
|
|
call plug#end()
|
|
|
|
Log &rtp
|
|
|
|
|
|
|
|
PlugInstall
|
|
|
|
q
|
|
|
|
let found = filter(split(globpath(&rtp, 'README.md'), '\n'), 'v:val =~ ","')
|
|
|
|
Log found
|
|
|
|
AssertEqual 1, len(found)
|
|
|
|
|
|
|
|
**********************************************************************
|
|
|
|
Execute (Strict load order):
|
|
|
|
let g:total_order = []
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/xxx'
|
|
|
|
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
2014-09-22 17:21:48 +02:00
|
|
|
call plug#end()
|
|
|
|
call EnsureLoaded()
|
|
|
|
setf xxx
|
|
|
|
Log 'Case 1: ' . &rtp
|
|
|
|
AssertEqual ['yyy/ftdetect', 'yyy/after/ftdetect', 'xxx/ftdetect', 'xxx/after/ftdetect'], g:total_order[0:3]
|
|
|
|
Assert index(g:total_order, 'xxx/plugin') < index(g:total_order, 'yyy/plugin')
|
|
|
|
Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
|
|
|
|
let len = len(split(&rtp, ','))
|
|
|
|
|
|
|
|
let g:total_order = []
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
|
|
|
Plug '$PLUG_FIXTURES/yyy'
|
2014-09-22 17:21:48 +02:00
|
|
|
call plug#end()
|
|
|
|
call EnsureLoaded()
|
|
|
|
set rtp^=manually-prepended
|
|
|
|
set rtp+=manually-appended
|
|
|
|
setf xxx
|
|
|
|
Log 'Case 2: ' . &rtp
|
|
|
|
AssertEqual 'manually-prepended', split(&rtp, ',')[3]
|
|
|
|
AssertEqual 'manually-appended', split(&rtp, ',')[-4]
|
|
|
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'yyy/ftdetect', 'yyy/after/ftdetect'], g:total_order[0:3]
|
|
|
|
Assert index(g:total_order, 'yyy/plugin') < index(g:total_order, 'xxx/plugin')
|
|
|
|
Assert index(g:total_order, 'yyy/after/plugin') < index(g:total_order, 'xxx/after/plugin')
|
|
|
|
AssertEqual len + 2, len(split(&rtp, ','))
|
|
|
|
|
|
|
|
let g:total_order = []
|
|
|
|
call plug#begin()
|
2014-10-19 07:45:19 +02:00
|
|
|
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
|
|
|
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
2014-09-22 17:21:48 +02:00
|
|
|
call plug#end()
|
|
|
|
call EnsureLoaded()
|
|
|
|
setf xxx
|
|
|
|
Log 'Case 3: ' . &rtp
|
|
|
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'yyy/ftdetect', 'yyy/after/ftdetect'], g:total_order[0:3]
|
|
|
|
Assert index(g:total_order, 'xxx/plugin') < index(g:total_order, 'yyy/plugin')
|
|
|
|
Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
|
|
|
|
AssertEqual len + 2, len(split(&rtp, ','))
|
|
|
|
|
2014-09-27 07:41:57 +02:00
|
|
|
**********************************************************************
|
|
|
|
Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home):
|
2014-10-19 07:45:19 +02:00
|
|
|
call plug#begin('$PLUG_FIXTURES')
|
|
|
|
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': [] }
|
|
|
|
Plug '$PLUG_FIXTURES/fzf'
|
|
|
|
Plug '$PLUG_FIXTURES/xxx'
|
|
|
|
Plug '$PLUG_FIXTURES/yyy'
|
2014-09-27 07:41:57 +02:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" Remove z1, z2
|
|
|
|
PlugClean!
|
|
|
|
AssertExpect '^- ', 2
|
|
|
|
AssertExpect 'Already clean', 0
|
|
|
|
|
|
|
|
PlugClean!
|
|
|
|
AssertExpect '^- ', 0
|
|
|
|
AssertExpect 'Already clean', 1
|
|
|
|
q
|
|
|
|
|
2014-10-01 16:14:27 +02:00
|
|
|
**********************************************************************
|
2015-02-12 03:35:05 +01:00
|
|
|
Execute (PlugSnapshot / #154 issues with paths containing spaces):
|
|
|
|
call plug#begin('$TMPDIR/plug with spaces')
|
|
|
|
Plug 'junegunn/vim-easy-align'
|
2014-10-01 16:14:27 +02:00
|
|
|
Plug 'junegunn/seoul256.vim'
|
|
|
|
call plug#end()
|
|
|
|
|
2014-11-20 17:06:17 +01:00
|
|
|
PlugClean!
|
2014-10-01 16:14:27 +02:00
|
|
|
PlugInstall
|
2015-02-12 03:38:48 +01:00
|
|
|
call plug#load('vim-easy-align') " Should properly handle paths with spaces
|
2014-10-01 16:14:27 +02:00
|
|
|
PlugSnapshot
|
2015-02-07 17:07:56 +01:00
|
|
|
AssertEqual '#!/bin/sh', getline(1)
|
2014-10-01 16:14:27 +02:00
|
|
|
AssertEqual '# Generated by vim-plug', getline(2)
|
|
|
|
AssertEqual 'vim +PlugUpdate +qa', getline(5)
|
2015-02-12 03:35:05 +01:00
|
|
|
AssertEqual 'PLUG_HOME=$TMPDIR/plug\ with\ spaces', getline(7)
|
2014-10-01 16:14:27 +02:00
|
|
|
AssertEqual 0, stridx(getline(9), 'cd $PLUG_HOME/seoul256.vim/ && git reset --hard')
|
2015-02-12 03:35:05 +01:00
|
|
|
AssertEqual 0, stridx(getline(10), 'cd $PLUG_HOME/vim-easy-align/ && git reset --hard')
|
2014-10-01 18:17:46 +02:00
|
|
|
AssertEqual 'sh', &filetype
|
|
|
|
|
|
|
|
execute 'PlugSnapshot' g:plug_home.'/snapshot.sh'
|
|
|
|
AssertEqual 'sh', &filetype
|
|
|
|
AssertEqual 'snapshot.sh', fnamemodify(expand('%'), ':t')
|
2014-10-01 16:14:27 +02:00
|
|
|
q
|
|
|
|
|