1
0
forked from aniani/vim

patch 8.1.1846: inconsistently using GetVimCommand() and v:progpath

Problem:    Inconsistently using GetVimCommand() and v:progpath. (Daniel
            Hahler)
Solution:   Use GetVimCommand(). (closes #4806)
This commit is contained in:
Bram Moolenaar
2019-08-14 21:12:05 +02:00
parent 6ace95e981
commit 93344c2d70
8 changed files with 45 additions and 39 deletions

View File

@@ -1,5 +1,7 @@
" Tests for system() and systemlist()
source shared.vim
func Test_System()
if !executable('echo') || !executable('cat') || !executable('wc')
return
@@ -49,11 +51,11 @@ endfunc
func Test_system_exmode()
if has('unix') " echo $? only works on Unix
let cmd = ' -es -u NONE -c "source Xscript" +q; echo "result=$?"'
let cmd = ' -es -c "source Xscript" +q; echo "result=$?"'
" Need to put this in a script, "catch" isn't found after an unknown
" function.
call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript')
let a = system(v:progpath . cmd)
let a = system(GetVimCommand() . cmd)
call assert_match('result=0', a)
call assert_equal(0, v:shell_error)
endif
@@ -61,32 +63,32 @@ func Test_system_exmode()
" Error before try does set error flag.
call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript')
if has('unix') " echo $? only works on Unix
let a = system(v:progpath . cmd)
let a = system(GetVimCommand() . cmd)
call assert_notequal('0', a[0])
endif
let cmd = ' -es -u NONE -c "source Xscript" +q'
let a = system(v:progpath . cmd)
let cmd = ' -es -c "source Xscript" +q'
let a = system(GetVimCommand() . cmd)
call assert_notequal(0, v:shell_error)
call delete('Xscript')
if has('unix') " echo $? only works on Unix
let cmd = ' -es -u NONE -c "call doesnotexist()" +q; echo $?'
let a = system(v:progpath. cmd)
let cmd = ' -es -c "call doesnotexist()" +q; echo $?'
let a = system(GetVimCommand() . cmd)
call assert_notequal(0, a[0])
endif
let cmd = ' -es -u NONE -c "call doesnotexist()" +q'
let a = system(v:progpath. cmd)
let cmd = ' -es -c "call doesnotexist()" +q'
let a = system(GetVimCommand(). cmd)
call assert_notequal(0, v:shell_error)
if has('unix') " echo $? only works on Unix
let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q; echo $?'
let a = system(v:progpath. cmd)
let cmd = ' -es -c "call doesnotexist()|let a=1" +q; echo $?'
let a = system(GetVimCommand() . cmd)
call assert_notequal(0, a[0])
endif
let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q'
let a = system(v:progpath. cmd)
let cmd = ' -es -c "call doesnotexist()|let a=1" +q'
let a = system(GetVimCommand() . cmd)
call assert_notequal(0, v:shell_error)
endfunc