annotate src/testdir/test_restricted.vim @ 17482:6cf077f59152 v8.1.1739

patch 8.1.1739: deleted match highlighting not updated in other window commit https://github.com/vim/vim/commit/06029a857a3d4d90b3162090506c1e00dc84c60b Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 24 14:25:26 2019 +0200 patch 8.1.1739: deleted match highlighting not updated in other window Problem: Deleted match highlighting not updated in other window. Solution: Mark the window for refresh. (closes https://github.com/vim/vim/issues/4720) Also fix that ambi-width check clears with wrong attributes.
author Bram Moolenaar <Bram@vim.org>
date Wed, 24 Jul 2019 14:30:08 +0200
parents cf702b29ea0d
children 906269bf83d5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15748
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test for "rvim" or "vim -Z"
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 source shared.vim
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4
15778
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
5 "if has('win32') && has('gui')
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
6 " " Win32 GUI shows a dialog instead of displaying the error in the last line.
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
7 " finish
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
8 "endif
15756
e43f30c5bad8 patch 8.1.0885: test for restricted hangs on MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15748
diff changeset
9
15748
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 func Test_restricted()
15778
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
11 call Run_restricted_test('!ls', 'E145:')
15748
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 func Run_restricted_test(ex_cmd, error)
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 let cmd = GetVimCommand('Xrestricted')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 if cmd == ''
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 return
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
15778
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
20 " Use a VimEnter autocommand to avoid that the error message is displayed in
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
21 " a dialog with an OK button.
15748
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 call writefile([
15778
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
23 \ "func Init()",
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
24 \ " silent! " . a:ex_cmd,
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
25 \ " call writefile([v:errmsg], 'Xrestrout')",
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
26 \ " qa!",
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
27 \ "endfunc",
cf702b29ea0d patch 8.1.0896: tests for restricted mode no run for MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents: 15756
diff changeset
28 \ "au VimEnter * call Init()",
15748
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 \ ], 'Xrestricted')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 call system(cmd . ' -Z')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call assert_match(a:error, join(readfile('Xrestrout')))
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 call delete('Xrestricted')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 call delete('Xrestrout')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 func Test_restricted_lua()
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 if !has('lua')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 throw 'Skipped: Lua is not supported'
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 call Run_restricted_test('lua print("Hello, Vim!")', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 call Run_restricted_test('luado return "hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 call Run_restricted_test('luafile somefile', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 call Run_restricted_test('call luaeval("expression")', 'E145:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 func Test_restricted_mzscheme()
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 if !has('mzscheme')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 throw 'Skipped: MzScheme is not supported'
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 call Run_restricted_test('mzscheme statement', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 call Run_restricted_test('mzfile somefile', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 call Run_restricted_test('call mzeval("expression")', 'E145:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 func Test_restricted_perl()
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 if !has('perl')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 throw 'Skipped: Perl is not supported'
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 " TODO: how to make Safe mode fail?
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 " call Run_restricted_test('perl system("ls")', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 " call Run_restricted_test('perldo system("hello")', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 " call Run_restricted_test('perlfile somefile', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 " call Run_restricted_test('call perleval("system(\"ls\")")', 'E145:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 func Test_restricted_python()
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 if !has('python')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 throw 'Skipped: Python is not supported'
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 call Run_restricted_test('python print "hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 call Run_restricted_test('pydo return "hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 call Run_restricted_test('pyfile somefile', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 call Run_restricted_test('call pyeval("expression")', 'E145:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 func Test_restricted_python3()
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 if !has('python3')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 throw 'Skipped: Python3 is not supported'
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 call Run_restricted_test('py3 print "hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 call Run_restricted_test('py3do return "hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 call Run_restricted_test('py3file somefile', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 call Run_restricted_test('call py3eval("expression")', 'E145:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 func Test_restricted_ruby()
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 if !has('ruby')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 throw 'Skipped: Ruby is not supported'
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 call Run_restricted_test('ruby print "Hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 call Run_restricted_test('rubydo print "Hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 call Run_restricted_test('rubyfile somefile', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 endfunc
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 func Test_restricted_tcl()
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 if !has('tcl')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 throw 'Skipped: Tcl is not supported'
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 endif
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 call Run_restricted_test('tcl puts "Hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 call Run_restricted_test('tcldo puts "Hello"', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 call Run_restricted_test('tclfile somefile', 'E981:')
93b78c4a7cd5 patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 endfunc