Mercurial > vim
changeset 15778:cf702b29ea0d v8.1.0896
patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
commit https://github.com/vim/vim/commit/5a6698169d10833abad88c98e5a332ddde5d110d
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 11 21:45:00 2019 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 11 Feb 2019 22:00:07 +0100 |
parents | 8ee4000692f3 |
children | 503f872f0ec3 |
files | src/testdir/test_restricted.vim src/version.c |
diffstat | 2 files changed, 15 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_restricted.vim +++ b/src/testdir/test_restricted.vim @@ -2,27 +2,13 @@ source shared.vim -if has('win32') && has('gui') - " Win32 GUI shows a dialog instead of displaying the error in the last line. - finish -endif +"if has('win32') && has('gui') +" " Win32 GUI shows a dialog instead of displaying the error in the last line. +" finish +"endif func Test_restricted() - let cmd = GetVimCommand('Xrestricted') - 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') + call Run_restricted_test('!ls', 'E145:') endfunc func Run_restricted_test(ex_cmd, error) @@ -31,10 +17,15 @@ func Run_restricted_test(ex_cmd, error) return endif + " Use a VimEnter autocommand to avoid that the error message is displayed in + " a dialog with an OK button. call writefile([ - \ a:ex_cmd, - \ "call writefile([v:errmsg], 'Xrestrout')", - \ "qa!", + \ "func Init()", + \ " silent! " . a:ex_cmd, + \ " call writefile([v:errmsg], 'Xrestrout')", + \ " qa!", + \ "endfunc", + \ "au VimEnter * call Init()", \ ], 'Xrestricted') call system(cmd . ' -Z') call assert_match(a:error, join(readfile('Xrestrout')))