added test for plugconfig
This commit is contained in:
parent
1c61604af0
commit
80641f6e8b
4
test/run
4
test/run
|
@ -86,6 +86,10 @@ DOC
|
||||||
make_dirs z1/ z1
|
make_dirs z1/ z1
|
||||||
make_dirs z2/ z2
|
make_dirs z2/ z2
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p "$TEMP/configs"
|
||||||
|
echo "let g:plug_config_vader_test = 1" > "$TEMP/configs/yyy.vim"
|
||||||
|
|
||||||
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||||
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
||||||
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||||
|
|
|
@ -16,6 +16,7 @@ Execute (Initialize test environment):
|
||||||
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
||||||
let patch =
|
let patch =
|
||||||
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
|
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
|
||||||
|
\ 'function! ResetPlugConfig()', 'unlet s:config_dirs', 'endfunction',
|
||||||
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']
|
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']
|
||||||
|
|
||||||
if $ENV != 'vim8'
|
if $ENV != 'vim8'
|
||||||
|
|
|
@ -1631,3 +1631,46 @@ Execute (#532 - Reuse plug window):
|
||||||
AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')'
|
AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')'
|
||||||
AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
|
AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
|
||||||
q
|
q
|
||||||
|
|
||||||
|
Execute (PlugConfig shall create a new file 1/2):
|
||||||
|
call ResetPlug()
|
||||||
|
call ResetPlugConfig()
|
||||||
|
let g:plug_config_dir = $TEMP . '/configs'
|
||||||
|
let $PLUG_CONFIG_DIR = g:plug_config_dir
|
||||||
|
let g:plug_config_dirs = [g:plug_config_dir]
|
||||||
|
call plug#begin()
|
||||||
|
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
|
||||||
|
call plug#end()
|
||||||
|
AssertEqual 1, plug#load('xxx'), 'Loading Plugin Failed'
|
||||||
|
redir => out
|
||||||
|
PlugConfig xxx
|
||||||
|
AssertEqual 1, bufexists(g:plug_config_dir . '/xxx.vim'), 'Buffer not created ' . g:plug_config_dir . '/xxx.vim'
|
||||||
|
redir END
|
||||||
|
|
||||||
|
Execute (PlugConfig shall load config if lazy):
|
||||||
|
AssertEqual 1, filereadable(g:plug_config_dir . '/yyy.vim')
|
||||||
|
call ResetPlugConfig()
|
||||||
|
let g:plug_config_dirs = [g:plug_config_dir]
|
||||||
|
call ResetPlug()
|
||||||
|
call plug#begin()
|
||||||
|
Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
|
||||||
|
call plug#end()
|
||||||
|
redir => out
|
||||||
|
AssertEqual 0, exists('g:plug_config_vader_test'), 'Variable is set unexpected'
|
||||||
|
AssertEqual 1, plug#load('yyy'), 'Loading failed'
|
||||||
|
AssertEqual 1, exists('g:plug_config_vader_test'), 'Variable has not been set by config'
|
||||||
|
unlet g:plug_config_vader_test
|
||||||
|
redir END
|
||||||
|
|
||||||
|
Execute (PlugConfig shall load config automatically):
|
||||||
|
AssertEqual 1, filereadable(g:plug_config_dir . '/yyy.vim')
|
||||||
|
call ResetPlugConfig()
|
||||||
|
let g:plug_config_dirs = [g:plug_config_dir]
|
||||||
|
call ResetPlug()
|
||||||
|
AssertEqual 0, exists('g:plug_config_vader_test'), 'Variable is set unexpected'
|
||||||
|
call plug#begin()
|
||||||
|
Plug '$PLUG_FIXTURES/yyy'
|
||||||
|
call plug#end()
|
||||||
|
redir => out
|
||||||
|
AssertEqual 1, exists('g:plug_config_vader_test'), 'Variable has not been set by config'
|
||||||
|
redir END
|
||||||
|
|
Loading…
Reference in New Issue
Block a user