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