forked from aniani/vim
patch 7.4.2172
Problem: No test for "vim --help". Solution: Add a test.
This commit is contained in:
@@ -126,21 +126,32 @@ endfunc
|
|||||||
" "after" is a list of commands to be executed after loading plugins.
|
" "after" is a list of commands to be executed after loading plugins.
|
||||||
" Plugins are not loaded, unless 'loadplugins' is set in "before".
|
" Plugins are not loaded, unless 'loadplugins' is set in "before".
|
||||||
" Return 1 if Vim could be executed.
|
" Return 1 if Vim could be executed.
|
||||||
func RunVim(before, after)
|
func RunVim(before, after, arguments)
|
||||||
if !filereadable('vimcmd')
|
if !filereadable('vimcmd')
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
let args = a:arguments
|
||||||
|
if len(a:before) > 0
|
||||||
call writefile(a:before, 'Xbefore.vim')
|
call writefile(a:before, 'Xbefore.vim')
|
||||||
|
let args .= ' --cmd "so Xbefore.vim"'
|
||||||
|
endif
|
||||||
|
if len(a:after) > 0
|
||||||
call writefile(a:after, 'Xafter.vim')
|
call writefile(a:after, 'Xafter.vim')
|
||||||
|
let args .= ' -S Xafter.vim'
|
||||||
|
endif
|
||||||
|
|
||||||
let cmd = readfile('vimcmd')[0]
|
let cmd = readfile('vimcmd')[0]
|
||||||
let cmd = substitute(cmd, '-u \f\+', '-u NONE', '')
|
let cmd = substitute(cmd, '-u \f\+', '-u NONE', '')
|
||||||
if cmd !~ '-u NONE'
|
if cmd !~ '-u NONE'
|
||||||
let cmd = cmd . ' -u NONE'
|
let cmd = cmd . ' -u NONE'
|
||||||
endif
|
endif
|
||||||
exe "silent !" . cmd . " --cmd \"so Xbefore.vim\" -S Xafter.vim"
|
exe "silent !" . cmd . ' ' . args
|
||||||
|
|
||||||
|
if len(a:before) > 0
|
||||||
call delete('Xbefore.vim')
|
call delete('Xbefore.vim')
|
||||||
|
endif
|
||||||
|
if len(a:after) > 0
|
||||||
call delete('Xafter.vim')
|
call delete('Xafter.vim')
|
||||||
|
endif
|
||||||
return 1
|
return 1
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -41,7 +41,7 @@ func Test_after_comes_later()
|
|||||||
call mkdir('Xafter/plugin', 'p')
|
call mkdir('Xafter/plugin', 'p')
|
||||||
call writefile(['let done = 1'], 'Xafter/plugin/later.vim')
|
call writefile(['let done = 1'], 'Xafter/plugin/later.vim')
|
||||||
|
|
||||||
if RunVim(before, after)
|
if RunVim(before, after, '')
|
||||||
|
|
||||||
let lines = readfile('Xtestout')
|
let lines = readfile('Xtestout')
|
||||||
let expected = ['Xbefore.vim', 'here.vim', 'foo.vim', 'later.vim', 'Xafter.vim']
|
let expected = ['Xbefore.vim', 'here.vim', 'foo.vim', 'later.vim', 'Xafter.vim']
|
||||||
@@ -60,3 +60,24 @@ func Test_after_comes_later()
|
|||||||
call delete('Xhere', 'rf')
|
call delete('Xhere', 'rf')
|
||||||
call delete('Xafter', 'rf')
|
call delete('Xafter', 'rf')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_help_arg()
|
||||||
|
if RunVim([], [], '--help >Xtestout')
|
||||||
|
let lines = readfile('Xtestout')
|
||||||
|
call assert_true(len(lines) > 20)
|
||||||
|
call assert_true(lines[0] =~ 'Vi IMproved')
|
||||||
|
|
||||||
|
" check if couple of lines are there
|
||||||
|
let found = 0
|
||||||
|
for line in lines
|
||||||
|
if line =~ '-R.*Readonly mode'
|
||||||
|
let found += 1
|
||||||
|
endif
|
||||||
|
if line =~ '--version'
|
||||||
|
let found += 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
call assert_equal(2, found)
|
||||||
|
endif
|
||||||
|
call delete('Xtestout')
|
||||||
|
endfunc
|
||||||
|
@@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2172,
|
||||||
/**/
|
/**/
|
||||||
2171,
|
2171,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user