Skip to content

Commit 97d62d4

Browse files
committed
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.
1 parent c011a3d commit 97d62d4

2 files changed

Lines changed: 28 additions & 23 deletions

File tree

src/testdir/test_system.vim

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,42 +48,45 @@ function! Test_System()
4848
endfunction
4949

5050
function! Test_system_exmode()
51-
if !has('unix')
52-
return
51+
if has('unix') " echo $? only works on Unix
52+
let cmd = ' -es -u NONE -c "source Xscript" +q; echo $?'
53+
" Need to put this in a script, "catch" isn't found after an unknown
54+
" function.
55+
call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript')
56+
let a = system(v:progpath . cmd)
57+
call assert_equal('0', a[0])
58+
call assert_equal(0, v:shell_error)
5359
endif
5460

55-
let cmd=" -es -u NONE -c 'source Xscript' +q; echo $?"
56-
" Need to put this in a script, "catch" isn't found after an unknown
57-
" function.
58-
call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript')
59-
let a = system(v:progpath . cmd)
60-
call assert_equal('0', a[0])
61-
call assert_equal(0, v:shell_error)
62-
6361
" Error before try does set error flag.
6462
call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript')
65-
let a = system(v:progpath . cmd)
66-
call assert_notequal('0', a[0])
63+
if has('unix') " echo $? only works on Unix
64+
let a = system(v:progpath . cmd)
65+
call assert_notequal('0', a[0])
66+
endif
6767

68-
let cmd=" -es -u NONE -c 'source Xscript' +q"
68+
let cmd = ' -es -u NONE -c "source Xscript" +q'
6969
let a = system(v:progpath . cmd)
7070
call assert_notequal(0, v:shell_error)
71+
call delete('Xscript')
7172

72-
let cmd=" -es -u NONE -c 'call doesnotexist()' +q; echo $?"
73-
let a = system(v:progpath. cmd)
74-
call assert_notequal(0, a[0])
73+
if has('unix') " echo $? only works on Unix
74+
let cmd = ' -es -u NONE -c "call doesnotexist()" +q; echo $?'
75+
let a = system(v:progpath. cmd)
76+
call assert_notequal(0, a[0])
77+
endif
7578

76-
let cmd=" -es -u NONE -c 'call doesnotexist()' +q"
79+
let cmd = ' -es -u NONE -c "call doesnotexist()" +q'
7780
let a = system(v:progpath. cmd)
7881
call assert_notequal(0, v:shell_error)
7982

80-
let cmd=" -es -u NONE -c 'call doesnotexist()|let a=1' +q; echo $?"
81-
let a = system(v:progpath. cmd)
82-
call assert_notequal(0, a[0])
83+
if has('unix') " echo $? only works on Unix
84+
let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q; echo $?'
85+
let a = system(v:progpath. cmd)
86+
call assert_notequal(0, a[0])
87+
endif
8388

84-
let cmd=" -es -u NONE -c 'call doesnotexist()|let a=1' +q"
89+
let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q'
8590
let a = system(v:progpath. cmd)
8691
call assert_notequal(0, v:shell_error)
87-
88-
call delete('Xscript')
8992
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
197,
767769
/**/
768770
196,
769771
/**/

0 commit comments

Comments
 (0)