Test refactoring
This commit is contained in:
parent
50cd5e5819
commit
f85d4d774b
5
test/fixtures/.gitignore
vendored
5
test/fixtures/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
|||
fzf*
|
||||
xxx
|
||||
yyy
|
||||
z1
|
||||
z2
|
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
|
@ -1 +0,0 @@
|
|||
echomsg 'ftplugin'
|
|
@ -19,7 +19,7 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
|||
|
||||
**********************************************************************
|
||||
Execute (#114 Should not contain empty path in &rtp):
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
|
@ -35,7 +35,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
|||
|
||||
" Cleared on command
|
||||
call ReloadPlug()
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
|
@ -52,7 +52,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
|||
|
||||
" Cleared on FileType
|
||||
call ReloadPlug()
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
|
||||
call plug#end()
|
||||
|
||||
|
@ -78,13 +78,13 @@ Execute (#131 Syntax error):
|
|||
**********************************************************************
|
||||
Execute (#139-1 Using new remote branch):
|
||||
" Make sure to remove the clone
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Install master branch
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
Plug expand('file:///$TMPDIR/new-branch')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
|
||||
|
@ -95,14 +95,14 @@ Execute (#139-1 Using new remote branch):
|
|||
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||
|
||||
" Create a new branch on origin
|
||||
call system('cd $TMPDIR/new-branch && git checkout -b new &&'
|
||||
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
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'new' }
|
||||
Plug expand('file:////tmp/new-branch'), { 'branch': 'new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
|
@ -125,14 +125,14 @@ Expect:
|
|||
|
||||
Execute (#139-2 Using yet another new remote branch):
|
||||
" Create another branch on origin
|
||||
call system('cd $TMPDIR/new-branch && git checkout master &&'
|
||||
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 &&'
|
||||
\. 'git commit -m third')
|
||||
|
||||
" Test Vim installer here
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'brand-new' }
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug expand('file:////tmp/new-branch'), { 'branch': 'brand-new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
|
@ -154,19 +154,19 @@ Expect:
|
|||
|
||||
Execute (#139-3 Should fail when not possible to fast-forward):
|
||||
" Commit on cloned repo
|
||||
call system('cd $TMPDIR/plugged/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/plugged/new-branch && git checkout master &&'
|
||||
\. 'touch foobar && git add foobar && git commit -m foobar')
|
||||
|
||||
" Different commit on remote
|
||||
call system('cd $TMPDIR/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/new-branch && git checkout master &&'
|
||||
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
|
||||
|
||||
for multi in [0, 1]
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
if multi
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
endif
|
||||
Plug expand('file:///$TMPDIR/new-branch')
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
|
@ -210,7 +210,7 @@ Execute (#159: shell=/bin/tcsh):
|
|||
let org = &shell
|
||||
try
|
||||
set shell=/bin/tcsh
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
|
||||
|
@ -224,7 +224,7 @@ Execute (#159: shell=/bin/tcsh):
|
|||
|
||||
**********************************************************************
|
||||
Execute (#154: Spaces in &rtp should not be escaped):
|
||||
call plug#begin('$TMPDIR/plug it')
|
||||
call plug#begin('/tmp/plug it')
|
||||
Plug 'seoul256 vim'
|
||||
call plug#end()
|
||||
Log &rtp
|
||||
|
@ -232,7 +232,7 @@ Execute (#154: Spaces in &rtp should not be escaped):
|
|||
|
||||
**********************************************************************
|
||||
Execute (#184: Duplicate entries in &rtp):
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'plugin1'
|
||||
\| Plug 'plugin0'
|
||||
|
||||
|
@ -250,7 +250,7 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
|||
silent! delc EasyAlign
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
|
@ -259,7 +259,7 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
|||
%EasyAlign=
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
|
||||
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
|
||||
|
|
76
test/run
76
test/run
|
@ -1,11 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $(dirname $BASH_SOURCE)
|
||||
cd ..
|
||||
PLUG_SRC=$(pwd)/plug.vim
|
||||
cd - > /dev/null
|
||||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
export PLUG_FIXTURES=$(pwd)/fixtures
|
||||
export BASE="$PWD"
|
||||
export PLUG_SRC="$PWD/../plug.vim"
|
||||
export PLUG_FIXTURES="$PWD/fixtures"
|
||||
mkdir -p "$PLUG_FIXTURES"
|
||||
|
||||
cat > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=/tmp/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
VIMRC
|
||||
|
||||
clone() {
|
||||
if [ ! -d $2 ]; then
|
||||
|
@ -13,25 +18,25 @@ clone() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Clone
|
||||
cd /tmp
|
||||
mkdir -p junegunn vim-scripts jg
|
||||
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||
clone_repos() {
|
||||
cd /tmp
|
||||
mkdir -p junegunn vim-scripts jg
|
||||
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||
vim-oblique vim-pseudocl vim-redis vim-emoji; do
|
||||
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
|
||||
done
|
||||
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
|
||||
done
|
||||
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
|
||||
clone https://github.com/junegunn/fzf.git fzf &
|
||||
wait
|
||||
|
||||
rm -rf $PLUG_FIXTURES/fzf
|
||||
clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged &
|
||||
wait
|
||||
clone junegunn/vim-emoji jg/vim-emoji
|
||||
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
|
||||
|
||||
(cd junegunn/seoul256.vim &&
|
||||
git checkout no-t_co && git checkout master) > /dev/null 2>&1
|
||||
clone junegunn/vim-emoji jg/vim-emoji
|
||||
cd - > /dev/null
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
make_dirs() {
|
||||
rm -rf "$PLUG_FIXTURES/$1"
|
||||
mkdir -p "$PLUG_FIXTURES/$1"
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||
|
@ -46,17 +51,15 @@ make_dirs() {
|
|||
call add(g:total_order, s:name)
|
||||
EOF
|
||||
done
|
||||
cd - > /dev/null
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
init() {
|
||||
rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
|
||||
rm -rf $TMPDIR/new-branch
|
||||
|
||||
prepare() {
|
||||
make_dirs xxx/ xxx
|
||||
make_dirs xxx/after xxx
|
||||
mkdir -p $PLUG_FIXTURES/xxx/doc
|
||||
cat > $PLUG_FIXTURES/xxx/doc/xxx.txt << DOC
|
||||
mkdir -p "$PLUG_FIXTURES/xxx/doc"
|
||||
cat > "$PLUG_FIXTURES/xxx/doc/xxx.txt" << DOC
|
||||
hello *xxx*
|
||||
DOC
|
||||
|
||||
|
@ -66,28 +69,27 @@ DOC
|
|||
make_dirs z1/ z1
|
||||
make_dirs z2/ z2
|
||||
|
||||
(
|
||||
cd $TMPDIR
|
||||
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
||||
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
|
||||
rm -rf /tmp/new-branch
|
||||
cd /tmp
|
||||
git init new-branch
|
||||
cd new-branch
|
||||
mkdir plugin
|
||||
echo 'let g:foo = 1' > plugin/foo.vim
|
||||
git add plugin/foo.vim
|
||||
git commit -m initial
|
||||
)
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
cat > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=/tmp/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
source $PLUG_SRC
|
||||
VIMRC
|
||||
|
||||
[ -z "$TMPDIR" ] && export TMPDIR=/tmp/
|
||||
init
|
||||
clone_repos
|
||||
prepare
|
||||
if [ "$1" = '!' ]; then
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
init &&
|
||||
prepare &&
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
else
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
Execute (Initialize test environment):
|
||||
Save &rtp, g:plugs, g:plug_home, g:plug_window
|
||||
|
||||
let first_rtp = split(&rtp, ',')[0]
|
||||
let last_rtp = split(&rtp, ',')[-1]
|
||||
|
||||
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
|
||||
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
|
||||
set rtp=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
|
||||
execute 'set rtp^='.vader
|
||||
execute 'set rtp^='.plug
|
||||
let basertp = &rtp
|
||||
|
||||
unlet! g:plugs g:plug_home g:plug_window
|
||||
|
||||
let g:plug_url_format = 'file:///tmp/%s'
|
||||
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
|
||||
|
||||
set t_Co=256
|
||||
colo default
|
||||
|
@ -39,19 +36,27 @@ Execute (Initialize test environment):
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! RmRf(file)
|
||||
call system(printf('rm -rf "%s"', a:file))
|
||||
endfunction
|
||||
|
||||
" Reload vim-plug to reset s:-variables
|
||||
function! ReloadPlug()
|
||||
let tmp = tempname()
|
||||
let tmpdir = tempname()
|
||||
let tmp = tmpdir.'/plug.vim'
|
||||
call mkdir(tmpdir, 'p')
|
||||
try
|
||||
call writefile(readfile(globpath(&rtp, 'autoload/plug.vim')), tmp)
|
||||
unlet g:loaded_plug
|
||||
call writefile(readfile($PLUG_SRC), tmp)
|
||||
unlet! g:loaded_plug
|
||||
execute 'source' tmp
|
||||
let &rtp = g:basertp
|
||||
let &rtp = g:base_rtp
|
||||
finally
|
||||
call delete(tmp)
|
||||
call RmRf(tmpdir)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
call ReloadPlug()
|
||||
|
||||
Execute (Print Interpreter Version):
|
||||
redir => out
|
||||
if has('ruby')
|
||||
|
@ -68,13 +73,9 @@ Include: workflow.vader
|
|||
Include: regressions.vader
|
||||
|
||||
Execute (Cleanup):
|
||||
silent! call system('rm -rf '.temp_plugged)
|
||||
silent! call system('rm -rf '.temp_plugged)
|
||||
silent! call rename(fzf, expand('$PLUG_FIXTURES/fzf-staged'))
|
||||
silent! unlet g:plugs
|
||||
silent! unlet g:plug_home
|
||||
silent! unlet g:plug_url_format
|
||||
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr found len
|
||||
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
|
||||
silent! delf PlugStatusSorted
|
||||
silent! delf AssertExpect
|
||||
silent! delf PlugUpdated
|
||||
|
|
|
@ -17,25 +17,25 @@ Execute (plug#begin() without path argument with empty &rtp):
|
|||
redir END
|
||||
Assert stridx(out, 'Unable to determine plug home') >= 0
|
||||
let &rtp = save_rtp
|
||||
unlet save_rtp
|
||||
|
||||
Execute (plug#begin(path)):
|
||||
let temp_plugged = tempname()
|
||||
call plug#begin(temp_plugged.'/')
|
||||
call plug#begin(g:temp_plugged.'/')
|
||||
Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
|
||||
|
||||
AssertEqual 0, len(g:plugs)
|
||||
AssertEqual temp_plugged, g:plug_home
|
||||
AssertEqual basertp, &rtp
|
||||
AssertEqual g:temp_plugged, g:plug_home
|
||||
AssertEqual g:base_rtp, &rtp
|
||||
|
||||
Execute (Subsequent plug#begin() calls will reuse g:plug_home):
|
||||
call plug#begin()
|
||||
AssertEqual temp_plugged, g:plug_home
|
||||
AssertEqual g:temp_plugged, g:plug_home
|
||||
|
||||
Execute (Test Plug command):
|
||||
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
|
||||
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
|
||||
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
|
||||
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
|
||||
|
@ -44,7 +44,7 @@ Execute (Test Plug command):
|
|||
^ Git repo with tag (DEPRECATED. USE TAG OPTION)
|
||||
Plug 'junegunn/goyo.vim', '1.5.2'
|
||||
AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
|
||||
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
||||
AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
||||
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
|
||||
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
|
||||
|
@ -54,7 +54,7 @@ Execute (Test Plug command):
|
|||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
|
||||
AssertEqual 'master', g:plugs['vim-emoji'].branch
|
||||
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
||||
AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
||||
|
||||
" vim-scripts/
|
||||
Plug 'beauty256'
|
||||
|
@ -66,7 +66,7 @@ Execute (Test Plug command):
|
|||
Execute (Plug command with dictionary option):
|
||||
Log string(g:plugs)
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
|
||||
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual '././', g:plugs['seoul256.vim'].rtp
|
||||
|
||||
Log string(g:plugs)
|
||||
|
@ -84,9 +84,9 @@ Execute (PlugClean before installation):
|
|||
|
||||
Execute (plug#end() updates &rtp):
|
||||
call plug#end()
|
||||
Assert len(&rtp) > len(basertp)
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
Assert len(&rtp) > len(g:base_rtp)
|
||||
AssertEqual g:first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual g:last_rtp, split(&rtp, ',')[-1]
|
||||
|
||||
Execute (Yet, plugins are not available):
|
||||
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
|
@ -276,6 +276,7 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
|
|||
call system(printf('cd /tmp/junegunn/%s && git commit --allow-empty -m "update"', repo))
|
||||
endfor
|
||||
endfor
|
||||
unlet repo
|
||||
PlugUpdate
|
||||
|
||||
" Now we have updates
|
||||
|
@ -309,6 +310,7 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
|
|||
" [[ motion
|
||||
execute 'normal 0[['
|
||||
AssertEqual lnum, line('.')
|
||||
unlet lnum
|
||||
AssertEqual 3, col('.')
|
||||
|
||||
" X key to revert the update
|
||||
|
@ -348,6 +350,7 @@ Execute (Reuse Plug window in another tab):
|
|||
AssertEqual tabnr, tabpagenr()
|
||||
normal! gt
|
||||
q
|
||||
unlet tabnr
|
||||
|
||||
**********************************************************************
|
||||
~ On-demand loading / Partial installation/update ~
|
||||
|
@ -392,8 +395,8 @@ Execute (Partial PlugInstall):
|
|||
PlugInstall vim-fnr vim-easy-align 1
|
||||
AssertExpect 'vim-fnr', 1
|
||||
AssertExpect 'vim-easy-align', 1
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
AssertEqual g:first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual g:last_rtp, split(&rtp, ',')[-1]
|
||||
q
|
||||
|
||||
Given (Unaligned code):
|
||||
|
@ -428,7 +431,6 @@ Execute (On-demand loading based on filetypes):
|
|||
Assert user_autocmd.redis
|
||||
AssertEqual 2, len(user_autocmd)
|
||||
|
||||
Then:
|
||||
autocmd! User
|
||||
unlet user_autocmd
|
||||
|
||||
|
@ -438,6 +440,7 @@ Then:
|
|||
|
||||
Execute (Add unmanaged plugin):
|
||||
let fzf = expand('$PLUG_FIXTURES/fzf')
|
||||
call RmRf(fzf)
|
||||
Log fzf
|
||||
|
||||
call plug#begin()
|
||||
|
@ -496,7 +499,8 @@ Execute (PlugStatus should point out that the plugin is missing):
|
|||
|
||||
Execute (Deploy unmanaged plugin):
|
||||
Assert !exists(':FZF'), ':FZF command should not exist'
|
||||
call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf)
|
||||
call RmRf(fzf)
|
||||
Log system(printf('cp -r "/tmp/fzf" "%s"', fzf))
|
||||
|
||||
Execute (PlugUpdate still should not care):
|
||||
PlugUpdate
|
||||
|
@ -516,8 +520,8 @@ Execute (Check &rtp after SomeCommand):
|
|||
Assert &rtp !~ 'fzf'
|
||||
silent! SomeCommand
|
||||
Assert &rtp =~ 'fzf'
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
AssertEqual g:first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual g:last_rtp, split(&rtp, ',')[-1]
|
||||
|
||||
Execute (Common parent):
|
||||
call plug#begin()
|
||||
|
@ -531,6 +535,8 @@ Execute (Common parent):
|
|||
AssertExpect! '[===]', 1
|
||||
q
|
||||
|
||||
unlet fzf
|
||||
|
||||
**********************************************************************
|
||||
~ Frozen plugins
|
||||
**********************************************************************
|
||||
|
@ -724,7 +730,7 @@ Execute (Using Funcref):
|
|||
|
||||
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
||||
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
||||
call RmRf(g:plugs['vim-pseudocl'].dir)
|
||||
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
|
@ -734,7 +740,7 @@ Execute (Using Funcref):
|
|||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'),
|
||||
\ 'vim-pseudocl/vim-pseudoclinstalled03 should exist'
|
||||
|
||||
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
||||
call RmRf(g:plugs['vim-pseudocl'].dir)
|
||||
PlugInstall!
|
||||
q
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'),
|
||||
|
@ -757,11 +763,11 @@ Execute (Using Funcref):
|
|||
Execute (Using custom dir):
|
||||
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
|
||||
call system('rm -rf '.$TMPDIR.'easy-align')
|
||||
call RmRf('/tmp/easy-align')
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': $TMPDIR.'easy-align' }
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/easy-align' }
|
||||
call plug#end()
|
||||
AssertEqual $TMPDIR.'easy-align/', g:plugs['vim-easy-align'].dir
|
||||
AssertEqual '/tmp/easy-align/', g:plugs['vim-easy-align'].dir
|
||||
|
||||
PlugClean!
|
||||
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
|
@ -924,7 +930,7 @@ Execute (Open plug window in a new tab):
|
|||
normal S
|
||||
AssertEqual tabnr, tabpagenr()
|
||||
q
|
||||
unlet g:plug_window
|
||||
unlet g:plug_window tabnr
|
||||
|
||||
**********************************************************************
|
||||
~ g:plug_url_format
|
||||
|
@ -970,7 +976,7 @@ Execute (Update plugin with U key in normal mode):
|
|||
q
|
||||
|
||||
Execute (Update plugins with U key in visual mode):
|
||||
silent! call system('rm -rf '.g:plugs['vim-easy-align'].dir)
|
||||
silent! call RmRf(g:plugs['vim-easy-align'].dir)
|
||||
|
||||
PlugStatus
|
||||
normal VGU
|
||||
|
@ -997,7 +1003,7 @@ Execute (plug#begin should expand env vars):
|
|||
|
||||
**********************************************************************
|
||||
Execute (Plug directory with comma):
|
||||
call plug#begin(temp_plugged . '/p,l,u,g,g,e,d')
|
||||
call plug#begin(g:temp_plugged . '/p,l,u,g,g,e,d')
|
||||
Plug 'junegunn/vim-emoji'
|
||||
call plug#end()
|
||||
Log &rtp
|
||||
|
@ -1007,6 +1013,7 @@ Execute (Plug directory with comma):
|
|||
let found = filter(split(globpath(&rtp, 'README.md'), '\n'), 'v:val =~ ","')
|
||||
Log found
|
||||
AssertEqual 1, len(found)
|
||||
unlet found
|
||||
|
||||
**********************************************************************
|
||||
Execute (Strict load order):
|
||||
|
@ -1079,6 +1086,7 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
|
|||
|
||||
**********************************************************************
|
||||
Execute (PlugSnapshot / #154 issues with paths containing spaces):
|
||||
let $TMPDIR = '/tmp'
|
||||
call plug#begin('$TMPDIR/plug with spaces')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
|
@ -1103,7 +1111,7 @@ Execute (PlugSnapshot / #154 issues with paths containing spaces):
|
|||
|
||||
**********************************************************************
|
||||
Execute (#221 Shallow-clone and tag option):
|
||||
call plug#begin(temp_plugged)
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim'
|
||||
call plug#end()
|
||||
PlugInstall
|
||||
|
@ -1122,12 +1130,12 @@ Execute (#221 Shallow-clone and tag option):
|
|||
cd -
|
||||
|
||||
Execute (#221 Shallow-clone disabled by g:plug_shallow = 0):
|
||||
call plug#begin(temp_plugged)
|
||||
call plug#begin(g:temp_plugged)
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
let g:plug_shallow = 0
|
||||
call plug#begin(temp_plugged)
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim'
|
||||
call plug#end()
|
||||
PlugInstall
|
||||
|
@ -1137,15 +1145,14 @@ Execute (#221 Shallow-clone disabled by g:plug_shallow = 0):
|
|||
Assert len(split(system('git log --oneline'), '\n')) > 1, 'not shallow'
|
||||
Assert !filereadable('.git/shallow'), 'not shallow'
|
||||
cd -
|
||||
Then:
|
||||
unlet g:plug_shallow
|
||||
|
||||
Execute (#221 Shallow-clone disabled by tag):
|
||||
call plug#begin(temp_plugged)
|
||||
call plug#begin(g:temp_plugged)
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
call plug#begin(temp_plugged)
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
|
||||
call plug#end()
|
||||
Assert !isdirectory(g:plugs['goyo.vim'].dir)
|
||||
|
|
Loading…
Reference in New Issue
Block a user