2015-01-07 12:14:48 +01:00
|
|
|
Execute (Initialize test environment):
|
|
|
|
Save &rtp, g:plugs, g:plug_home, g:plug_window
|
|
|
|
unlet! g:plugs g:plug_home g:plug_window
|
2015-05-28 12:03:49 +02:00
|
|
|
|
2016-06-16 15:17:03 +02:00
|
|
|
let g:plug_url_format = 'file:///tmp/vim-plug-test/%s'
|
2015-05-28 12:03:49 +02:00
|
|
|
let g:base_rtp = &rtp
|
|
|
|
let g:first_rtp = split(&rtp, ',')[0]
|
|
|
|
let g:last_rtp = split(&rtp, ',')[-1]
|
|
|
|
let g:temp_plugged = tempname()
|
|
|
|
if !exists('$PLUG_SRC')
|
|
|
|
let $PLUG_SRC = globpath(&rtp, 'autoload/plug.vim')
|
|
|
|
endif
|
2016-04-10 12:55:10 +02:00
|
|
|
let $PLUG_TMP = fnamemodify(tempname(), ':h').'/plug.vim'
|
2015-01-07 12:14:48 +01:00
|
|
|
|
2015-05-28 18:07:31 +02:00
|
|
|
" Temporarily patch plug.vim
|
2016-04-10 12:55:10 +02:00
|
|
|
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
2016-10-13 06:17:17 +02:00
|
|
|
let patch =
|
2016-10-08 16:32:48 +02:00
|
|
|
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
|
2016-10-13 06:17:17 +02:00
|
|
|
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']
|
|
|
|
|
|
|
|
if $ENV != 'vim8'
|
|
|
|
call add(patch, 'let s:vim8 = 0')
|
|
|
|
endif
|
|
|
|
|
|
|
|
call writefile(extend(readfile($PLUG_TMP), patch), $PLUG_TMP)
|
2015-05-28 18:07:31 +02:00
|
|
|
|
2015-01-07 12:14:48 +01:00
|
|
|
set t_Co=256
|
|
|
|
colo default
|
|
|
|
pclose
|
|
|
|
|
|
|
|
function! PlugStatusSorted()
|
|
|
|
PlugStatus
|
|
|
|
%y
|
|
|
|
q
|
|
|
|
normal! P
|
|
|
|
%sort
|
|
|
|
g/^$/d
|
|
|
|
endfunction
|
|
|
|
|
2018-03-04 05:43:13 +01:00
|
|
|
function! AssertExpect(bang, pat, cnt, ...)
|
2015-01-07 12:14:48 +01:00
|
|
|
let op = a:bang ? '==#' : '=~#'
|
2018-03-04 05:43:13 +01:00
|
|
|
let args = [a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))] + a:000
|
|
|
|
call call('vader#assert#equal', args)
|
2015-01-07 12:14:48 +01:00
|
|
|
endfunction
|
|
|
|
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
|
|
|
|
|
|
|
|
function! EnsureLoaded()
|
|
|
|
if has('vim_starting')
|
|
|
|
runtime! plugin/**/*.vim
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2015-05-28 12:03:49 +02:00
|
|
|
function! RmRf(file)
|
|
|
|
call system(printf('rm -rf "%s"', a:file))
|
|
|
|
endfunction
|
|
|
|
|
2015-05-28 05:34:43 +02:00
|
|
|
function! ReloadPlug()
|
2015-05-28 18:07:31 +02:00
|
|
|
call ResetPlug()
|
2016-04-10 12:55:10 +02:00
|
|
|
source $PLUG_TMP
|
2015-05-28 18:07:31 +02:00
|
|
|
let &rtp = g:base_rtp
|
2015-05-28 05:34:43 +02:00
|
|
|
endfunction
|
|
|
|
|
2016-04-03 03:52:30 +02:00
|
|
|
function! GitBranch(repo)
|
|
|
|
return system(printf('cd %s && git rev-parse --abbrev-ref HEAD', g:plugs[a:repo].dir))[:-2]
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! GitTag(repo)
|
|
|
|
return system(printf('cd %s && git describe --tags', g:plugs[a:repo].dir))[:-2]
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! GitCommit(repo)
|
|
|
|
return system(printf('cd %s && git rev-parse HEAD', g:plugs[a:repo].dir))[:-2]
|
|
|
|
endfunction
|
|
|
|
|
2016-04-10 12:55:10 +02:00
|
|
|
source $PLUG_TMP
|
2015-05-28 12:03:49 +02:00
|
|
|
|
2015-02-12 17:59:50 +01:00
|
|
|
Execute (Print Interpreter Version):
|
2015-01-07 12:14:48 +01:00
|
|
|
redir => out
|
2015-02-12 17:59:50 +01:00
|
|
|
if has('ruby')
|
2016-10-17 03:23:43 +02:00
|
|
|
silent! ruby puts 'Ruby: ' + RUBY_VERSION
|
|
|
|
endif
|
|
|
|
if has('python')
|
|
|
|
silent! python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
|
|
|
|
endif
|
|
|
|
if has('python3')
|
|
|
|
silent! python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
|
2015-02-12 17:59:50 +01:00
|
|
|
endif
|
2015-01-07 12:14:48 +01:00
|
|
|
redir END
|
2016-10-17 03:23:43 +02:00
|
|
|
Log split(out, '\n')
|
2015-01-07 12:14:48 +01:00
|
|
|
|
|
|
|
Include: workflow.vader
|
|
|
|
Include: regressions.vader
|
|
|
|
|
|
|
|
Execute (Cleanup):
|
2015-05-28 12:03:49 +02:00
|
|
|
silent! call RmRf(g:temp_plugged)
|
|
|
|
silent! unlet g:plugs g:plug_home g:plug_url_format
|
|
|
|
silent! unlet g:temp_plugged g:first_rtp g:last_rtp g:base_rtp out
|
2015-01-07 12:14:48 +01:00
|
|
|
silent! delf PlugStatusSorted
|
|
|
|
silent! delf AssertExpect
|
|
|
|
silent! delf PlugUpdated
|
|
|
|
silent! delf EnsureLoaded
|
2015-05-28 05:34:43 +02:00
|
|
|
silent! delf ReloadPlug
|
2015-01-07 12:14:48 +01:00
|
|
|
silent! delc AssertExpect
|
|
|
|
silent! unmap /
|
|
|
|
silent! unmap ?
|
2016-04-10 12:55:10 +02:00
|
|
|
call delete($PLUG_TMP)
|
2015-01-07 12:14:48 +01:00
|
|
|
|
|
|
|
Restore
|
|
|
|
|