|
@@ -27,6 +27,12 @@ Execute (Initialize test environment):
|
|
|
g/^$/d
|
|
g/^$/d
|
|
|
endfunction
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
+ function! AssertExpect(bang, pat, cnt)
|
|
|
|
|
+ let op = a:bang ? '==' : '=~'
|
|
|
|
|
+ AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
|
|
|
|
|
+ endfunction
|
|
|
|
|
+ command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
|
|
|
|
|
+
|
|
|
let g:vimrc_reloaded = 0
|
|
let g:vimrc_reloaded = 0
|
|
|
let vimrc = tempname()
|
|
let vimrc = tempname()
|
|
|
call writefile(['let g:vimrc_reloaded += 1'], vimrc)
|
|
call writefile(['let g:vimrc_reloaded += 1'], vimrc)
|
|
@@ -112,12 +118,12 @@ Execute (Plug command with dictionary option):
|
|
|
|
|
|
|
|
Execute (PlugStatus before installation):
|
|
Execute (PlugStatus before installation):
|
|
|
PlugStatus
|
|
PlugStatus
|
|
|
- AssertEqual 4, len(filter(getline(1, '$'), 'v:val =~ "Not found"'))
|
|
|
|
|
|
|
+ AssertExpect 'Not found', 4
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugClean before installation):
|
|
Execute (PlugClean before installation):
|
|
|
PlugClean
|
|
PlugClean
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "Already clean"'))
|
|
|
|
|
|
|
+ AssertExpect 'Already clean', 1
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (plug#end() updates &rtp):
|
|
Execute (plug#end() updates &rtp):
|
|
@@ -139,12 +145,13 @@ Execute (Plugin available after installation):
|
|
|
|
|
|
|
|
Execute (PlugClean after installation):
|
|
Execute (PlugClean after installation):
|
|
|
PlugClean
|
|
PlugClean
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "Already clean"'))
|
|
|
|
|
|
|
+ AssertExpect 'Already clean', 1
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugStatus after installation):
|
|
Execute (PlugStatus after installation):
|
|
|
PlugStatus
|
|
PlugStatus
|
|
|
- AssertEqual 4, len(filter(getline(1, '$'), 'v:val =~ "OK"'))
|
|
|
|
|
|
|
+ Log getline(1, '$')
|
|
|
|
|
+ AssertExpect 'OK', 4
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (Change tag of goyo.vim):
|
|
Execute (Change tag of goyo.vim):
|
|
@@ -215,8 +222,8 @@ Expect:
|
|
|
Execute (PlugClean! to remove seoul256.vim):
|
|
Execute (PlugClean! to remove seoul256.vim):
|
|
|
PlugClean!
|
|
PlugClean!
|
|
|
" Three removed, emoji left
|
|
" Three removed, emoji left
|
|
|
- AssertEqual 3, len(filter(getline(1, '$'), 'v:val =~ "^- "'))
|
|
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "Removed"'))
|
|
|
|
|
|
|
+ AssertExpect '^- ', 3
|
|
|
|
|
+ AssertExpect 'Removed', 1
|
|
|
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
|
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
|
|
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
|
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
|
|
q
|
|
q
|
|
@@ -242,15 +249,15 @@ Expect:
|
|
|
|
|
|
|
|
Execute (PlugClean! to remove vim-emoji):
|
|
Execute (PlugClean! to remove vim-emoji):
|
|
|
PlugClean!
|
|
PlugClean!
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "^- "'))
|
|
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "Removed"'))
|
|
|
|
|
|
|
+ AssertExpect '^- ', 1
|
|
|
|
|
+ AssertExpect 'Removed', 1
|
|
|
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
|
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
|
|
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
|
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugUpdate to install both again):
|
|
Execute (PlugUpdate to install both again):
|
|
|
PlugUpdate
|
|
PlugUpdate
|
|
|
- AssertEqual 2, len(filter(getline(1, '$'), 'v:val =~ "^- [^:]*:"'))
|
|
|
|
|
|
|
+ AssertExpect '^- [^:]*:', 2
|
|
|
AssertEqual 3, g:vimrc_reloaded
|
|
AssertEqual 3, g:vimrc_reloaded
|
|
|
Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
|
|
Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
|
|
|
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
|
|
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
|
|
@@ -258,7 +265,7 @@ Execute (PlugUpdate to install both again):
|
|
|
|
|
|
|
|
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
|
|
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
|
|
|
PlugUpdate
|
|
PlugUpdate
|
|
|
- AssertEqual 2, len(filter(getline(1, '$'), 'v:val =~ "Already up-to-date"'))
|
|
|
|
|
|
|
+ AssertExpect 'Already up-to-date', 2
|
|
|
AssertEqual 4, g:vimrc_reloaded
|
|
AssertEqual 4, g:vimrc_reloaded
|
|
|
normal D
|
|
normal D
|
|
|
AssertEqual 'No updates.', getline(1)
|
|
AssertEqual 'No updates.', getline(1)
|
|
@@ -365,9 +372,9 @@ Execute (Check commands):
|
|
|
|
|
|
|
|
Execute (Partial PlugInstall):
|
|
Execute (Partial PlugInstall):
|
|
|
PlugInstall vim-fnr vim-easy-align
|
|
PlugInstall vim-fnr vim-easy-align
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-pseudocl"'))
|
|
|
|
|
|
|
+ AssertExpect 'vim-pseudocl', 1
|
|
|
PlugInstall vim-fnr vim-easy-align 1
|
|
PlugInstall vim-fnr vim-easy-align 1
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-pseudocl"'))
|
|
|
|
|
|
|
+ AssertExpect 'vim-pseudocl', 1
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (Check dependent plugin):
|
|
Execute (Check dependent plugin):
|
|
@@ -438,26 +445,26 @@ Execute (Plug block for following tests):
|
|
|
Execute (PlugInstall will only install vim-easy-align):
|
|
Execute (PlugInstall will only install vim-easy-align):
|
|
|
PlugInstall
|
|
PlugInstall
|
|
|
Log getline(1, '$')
|
|
Log getline(1, '$')
|
|
|
- AssertEqual 0, len(filter(getline(1, '$'), 'v:val =~ "fzf"'))
|
|
|
|
|
|
|
+ AssertExpect 'fzf', 0
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugUpdate will only update vim-easy-align):
|
|
Execute (PlugUpdate will only update vim-easy-align):
|
|
|
PlugUpdate
|
|
PlugUpdate
|
|
|
Log getline(1, '$')
|
|
Log getline(1, '$')
|
|
|
- AssertEqual 0, len(filter(getline(1, '$'), 'v:val =~ "fzf"'))
|
|
|
|
|
|
|
+ AssertExpect 'fzf', 0
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugClean should not care about unmanaged plugins):
|
|
Execute (PlugClean should not care about unmanaged plugins):
|
|
|
PlugClean
|
|
PlugClean
|
|
|
Log getline(1, '$')
|
|
Log getline(1, '$')
|
|
|
- AssertEqual 0, len(filter(getline(1, '$'), 'v:val =~ "fzf"'))
|
|
|
|
|
|
|
+ AssertExpect 'fzf', 0
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugStatus should point out that the plugin is missing):
|
|
Execute (PlugStatus should point out that the plugin is missing):
|
|
|
PlugStatus
|
|
PlugStatus
|
|
|
Log getline(1, '$')
|
|
Log getline(1, '$')
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "x fzf"'))
|
|
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "Not found"'))
|
|
|
|
|
|
|
+ AssertExpect 'x fzf', 1
|
|
|
|
|
+ AssertExpect 'Not found', 1
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (Deploy unmanaged plugin):
|
|
Execute (Deploy unmanaged plugin):
|
|
@@ -467,14 +474,14 @@ Execute (Deploy unmanaged plugin):
|
|
|
Execute (PlugUpdate still should not care):
|
|
Execute (PlugUpdate still should not care):
|
|
|
PlugUpdate
|
|
PlugUpdate
|
|
|
Log getline(1, '$')
|
|
Log getline(1, '$')
|
|
|
- AssertEqual 0, len(filter(getline(1, '$'), 'v:val =~ "fzf"'))
|
|
|
|
|
|
|
+ AssertExpect 'fzf', 0
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (PlugStatus with no error):
|
|
Execute (PlugStatus with no error):
|
|
|
PlugStatus
|
|
PlugStatus
|
|
|
Log getline(1, '$')
|
|
Log getline(1, '$')
|
|
|
- AssertEqual 0, len(filter(getline(1, '$'), 'v:val =~ "x fzf"'))
|
|
|
|
|
- AssertEqual 0, len(filter(getline(1, '$'), 'v:val =~ "Not found"'))
|
|
|
|
|
|
|
+ AssertExpect 'x fzf', 0
|
|
|
|
|
+ AssertExpect 'Not found', 0
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
Execute (Check &rtp after SomeCommand):
|
|
Execute (Check &rtp after SomeCommand):
|
|
@@ -494,7 +501,7 @@ Execute (Common parent):
|
|
|
|
|
|
|
|
PlugInstall
|
|
PlugInstall
|
|
|
Log getline(1, '$')
|
|
Log getline(1, '$')
|
|
|
- AssertEqual 1, len(filter(getline(1, '$'), 'v:val == "[===]"'))
|
|
|
|
|
|
|
+ AssertExpect! '[===]', 1
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
**********************************************************************
|
|
**********************************************************************
|
|
@@ -527,6 +534,48 @@ Execute (But you can still install it if the name is given as the argument):
|
|
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
|
|
q
|
|
q
|
|
|
|
|
|
|
|
|
|
+**********************************************************************
|
|
|
|
|
+~ 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
|
|
|
|
|
+
|
|
|
Execute (Cleanup):
|
|
Execute (Cleanup):
|
|
|
call system('rm -rf '.temp_plugged)
|
|
call system('rm -rf '.temp_plugged)
|
|
|
call rename('fzf', 'fzf-staged')
|
|
call rename('fzf', 'fzf-staged')
|
|
@@ -536,5 +585,7 @@ Execute (Cleanup):
|
|
|
unlet g:vimrc_reloaded
|
|
unlet g:vimrc_reloaded
|
|
|
unlet temp_plugged vader plug basertp save_rtp repo lnum fzf
|
|
unlet temp_plugged vader plug basertp save_rtp repo lnum fzf
|
|
|
delf PlugStatusSorted
|
|
delf PlugStatusSorted
|
|
|
|
|
+ delf AssertExpect
|
|
|
|
|
+ delc AssertExpect
|
|
|
|
|
|
|
|
Restore
|
|
Restore
|