mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 12:28:18 +00:00
vim-patch:8.1.0896: tests for restricted mode no run for MS-Windows GUI
Problem: Tests for restricted mode no run for MS-Windows GUI.
Solution: Make tests also work in MS-Windows GUI.
5a6698169d
This commit is contained in:
@@ -2,27 +2,13 @@
|
|||||||
|
|
||||||
source shared.vim
|
source shared.vim
|
||||||
|
|
||||||
if has('win32') && has('gui')
|
"if has('win32') && has('gui')
|
||||||
" Win32 GUI shows a dialog instead of displaying the error in the last line.
|
" " Win32 GUI shows a dialog instead of displaying the error in the last line.
|
||||||
finish
|
" finish
|
||||||
endif
|
"endif
|
||||||
|
|
||||||
func Test_restricted()
|
func Test_restricted()
|
||||||
let cmd = GetVimCommand('Xrestricted')
|
call Run_restricted_test('!ls', 'E145:')
|
||||||
if cmd == ''
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
call writefile([
|
|
||||||
\ "silent !ls",
|
|
||||||
\ "call writefile([v:errmsg], 'Xrestrout')",
|
|
||||||
\ "qa!",
|
|
||||||
\ ], 'Xrestricted')
|
|
||||||
call system(cmd . ' -Z')
|
|
||||||
call assert_match('E145:', join(readfile('Xrestrout')))
|
|
||||||
|
|
||||||
call delete('Xrestricted')
|
|
||||||
call delete('Xrestrout')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Run_restricted_test(ex_cmd, error)
|
func Run_restricted_test(ex_cmd, error)
|
||||||
@@ -31,10 +17,15 @@ func Run_restricted_test(ex_cmd, error)
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Use a VimEnter autocommand to avoid that the error message is displayed in
|
||||||
|
" a dialog with an OK button.
|
||||||
call writefile([
|
call writefile([
|
||||||
\ a:ex_cmd,
|
\ "func Init()",
|
||||||
\ "call writefile([v:errmsg], 'Xrestrout')",
|
\ " silent! " . a:ex_cmd,
|
||||||
\ "qa!",
|
\ " call writefile([v:errmsg], 'Xrestrout')",
|
||||||
|
\ " qa!",
|
||||||
|
\ "endfunc",
|
||||||
|
\ "au VimEnter * call Init()",
|
||||||
\ ], 'Xrestricted')
|
\ ], 'Xrestricted')
|
||||||
call system(cmd . ' -Z')
|
call system(cmd . ' -Z')
|
||||||
call assert_match(a:error, join(readfile('Xrestrout')))
|
call assert_match(a:error, join(readfile('Xrestrout')))
|
||||||
|
Reference in New Issue
Block a user