Mercurial > vim
changeset 10615:de4aae865134 v8.0.0197
patch 8.0.0197: system() test skips some parts for MS-Windows
commit https://github.com/vim/vim/commit/97d62d4321df358665e2e6504aad8ac2ba7fd841
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 16 22:53:57 2017 +0100
patch 8.0.0197: system() test skips some parts for MS-Windows
Problem: On MS-Windows the system() test skips a few parts.
Solution: Swap single and double quotes for the command.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 16 Jan 2017 23:00:04 +0100 |
parents | cbab5be3e9b7 |
children | db8a2a027ef7 |
files | src/testdir/test_system.vim src/version.c |
diffstat | 2 files changed, 28 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_system.vim +++ b/src/testdir/test_system.vim @@ -48,42 +48,45 @@ function! Test_System() endfunction function! Test_system_exmode() - if !has('unix') - return + if has('unix') " echo $? only works on Unix + let cmd = ' -es -u NONE -c "source Xscript" +q; echo $?' + " 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) + call assert_equal('0', a[0]) + call assert_equal(0, v:shell_error) endif - let cmd=" -es -u NONE -c 'source Xscript' +q; echo $?" - " 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) - call assert_equal('0', a[0]) - call assert_equal(0, v:shell_error) - " Error before try does set error flag. call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') - let a = system(v:progpath . cmd) - call assert_notequal('0', a[0]) + if has('unix') " echo $? only works on Unix + let a = system(v:progpath . cmd) + call assert_notequal('0', a[0]) + endif - let cmd=" -es -u NONE -c 'source Xscript' +q" + let cmd = ' -es -u NONE -c "source Xscript" +q' let a = system(v:progpath . cmd) call assert_notequal(0, v:shell_error) + call delete('Xscript') - let cmd=" -es -u NONE -c 'call doesnotexist()' +q; echo $?" - let a = system(v:progpath. cmd) - call assert_notequal(0, a[0]) + if has('unix') " echo $? only works on Unix + let cmd = ' -es -u NONE -c "call doesnotexist()" +q; echo $?' + let a = system(v:progpath. cmd) + call assert_notequal(0, a[0]) + endif - let cmd=" -es -u NONE -c 'call doesnotexist()' +q" + let cmd = ' -es -u NONE -c "call doesnotexist()" +q' let a = system(v:progpath. cmd) call assert_notequal(0, v:shell_error) - let cmd=" -es -u NONE -c 'call doesnotexist()|let a=1' +q; echo $?" - let a = system(v:progpath. cmd) - call assert_notequal(0, a[0]) + 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) + call assert_notequal(0, a[0]) + endif - let cmd=" -es -u NONE -c 'call doesnotexist()|let a=1' +q" + let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q' let a = system(v:progpath. cmd) call assert_notequal(0, v:shell_error) - - call delete('Xscript') endfunc