Merge pull request #361 from junegunn/snapshot-in-vimscript

PlugSnapshot output in Vim script format (#360)
This commit is contained in:
Junegunn Choi
2015-12-17 23:34:37 +09:00
3 changed files with 52 additions and 46 deletions

View File

@@ -1158,17 +1158,22 @@ Execute (PlugSnapshot / #154 issues with paths containing spaces):
PlugInstall
call plug#load('vim-easy-align') " Should properly handle paths with spaces
PlugSnapshot
AssertEqual '#!/bin/sh', getline(1)
AssertEqual '# Generated by vim-plug', getline(2)
AssertEqual 'vim -c ''let g:plug_shallow = 0 | PlugUpdate | qa''', getline(5)
AssertEqual 'PLUG_HOME=$TMPDIR/plug\ with\ spaces', getline(7)
AssertEqual 0, stridx(getline(9), 'cd $PLUG_HOME/seoul256.vim/ && git reset --hard')
AssertEqual 0, stridx(getline(10), 'cd $PLUG_HOME/vim-easy-align/ && git reset --hard')
AssertEqual 'sh', &filetype
AssertEqual '" Generated by vim-plug', getline(1)
AssertEqual 0, stridx(getline(6), "silent! let g:plugs['seoul256.vim'].commit = '")
AssertEqual 0, stridx(getline(7), "silent! let g:plugs['vim-easy-align'].commit = '")
AssertEqual 'vim', &filetype
execute 'PlugSnapshot' g:plug_home.'/snapshot.sh'
AssertEqual 'sh', &filetype
AssertEqual 'snapshot.sh', fnamemodify(expand('%'), ':t')
call delete(g:plug_home.'/snapshot.vim')
execute 'PlugSnapshot' escape(g:plug_home.'/snapshot.vim', ' ')
AssertEqual 'vim', &filetype
AssertEqual 'snapshot.vim', fnamemodify(expand('%'), ':t')
q
Execute(PlugSnapshot! to overwrite existing file):
call writefile(['foobar'], g:plug_home.'/snapshot.vim')
AssertEqual 'foobar', readfile(g:plug_home.'/snapshot.vim')[0]
execute 'PlugSnapshot!' escape(g:plug_home.'/snapshot.vim', ' ')
AssertEqual '" Generated by vim-plug', readfile(g:plug_home.'/snapshot.vim')[0]
q
**********************************************************************
@@ -1259,7 +1264,8 @@ Execute (Commit hash support):
" Nor in PlugSnapshot output
PlugSnapshot
AssertEqual 9, line('$')
Log getline(1, '$')
AssertEqual 8, line('$')
q
Execute (Commit hash support - cleared):