comparison src/testdir/test_system.vim @ 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 234da476c4fd
children bcab4e804c20
comparison
equal deleted inserted replaced
10614:cbab5be3e9b7 10615:de4aae865134
46 46
47 call assert_fails('call system("wc -l", 99999)', 'E86:') 47 call assert_fails('call system("wc -l", 99999)', 'E86:')
48 endfunction 48 endfunction
49 49
50 function! Test_system_exmode() 50 function! Test_system_exmode()
51 if !has('unix') 51 if has('unix') " echo $? only works on Unix
52 return 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)
53 endif 59 endif
54
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 60
63 " Error before try does set error flag. 61 " Error before try does set error flag.
64 call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') 62 call writefile(['call nosuchfunction()', 'try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript')
65 let a = system(v:progpath . cmd) 63 if has('unix') " echo $? only works on Unix
66 call assert_notequal('0', a[0]) 64 let a = system(v:progpath . cmd)
65 call assert_notequal('0', a[0])
66 endif
67 67
68 let cmd=" -es -u NONE -c 'source Xscript' +q" 68 let cmd = ' -es -u NONE -c "source Xscript" +q'
69 let a = system(v:progpath . cmd) 69 let a = system(v:progpath . cmd)
70 call assert_notequal(0, v:shell_error) 70 call assert_notequal(0, v:shell_error)
71 call delete('Xscript')
71 72
72 let cmd=" -es -u NONE -c 'call doesnotexist()' +q; echo $?" 73 if has('unix') " echo $? only works on Unix
73 let a = system(v:progpath. cmd) 74 let cmd = ' -es -u NONE -c "call doesnotexist()" +q; echo $?'
74 call assert_notequal(0, a[0]) 75 let a = system(v:progpath. cmd)
76 call assert_notequal(0, a[0])
77 endif
75 78
76 let cmd=" -es -u NONE -c 'call doesnotexist()' +q" 79 let cmd = ' -es -u NONE -c "call doesnotexist()" +q'
77 let a = system(v:progpath. cmd) 80 let a = system(v:progpath. cmd)
78 call assert_notequal(0, v:shell_error) 81 call assert_notequal(0, v:shell_error)
79 82
80 let cmd=" -es -u NONE -c 'call doesnotexist()|let a=1' +q; echo $?" 83 if has('unix') " echo $? only works on Unix
81 let a = system(v:progpath. cmd) 84 let cmd = ' -es -u NONE -c "call doesnotexist()|let a=1" +q; echo $?'
82 call assert_notequal(0, a[0]) 85 let a = system(v:progpath. cmd)
86 call assert_notequal(0, a[0])
87 endif
83 88
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'
85 let a = system(v:progpath. cmd) 90 let a = system(v:progpath. cmd)
86 call assert_notequal(0, v:shell_error) 91 call assert_notequal(0, v:shell_error)
87
88 call delete('Xscript')
89 endfunc 92 endfunc