Mercurial > vim
annotate src/testdir/test87.in @ 10563:bac9cec298ed v8.0.0171
patch 8.0.0171: JS style JSON does not support single quotes
commit https://github.com/vim/vim/commit/ee142add229cbcd58bc76d59f23e02517df14379
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 11 21:50:08 2017 +0100
patch 8.0.0171: JS style JSON does not support single quotes
Problem: JS style JSON does not support single quotes.
Solution: Allow for single quotes. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/1371)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 11 Jan 2017 22:00:04 +0100 |
parents | 32dd27cceadd |
children | a99a1234625f |
rev | line source |
---|---|
3618 | 1 Tests for various python features. vim: set ft=vim : |
2 | |
3 STARTTEST | |
4 :so small.vim | |
4851
96e154e825a7
updated for version 7.3.1172
Bram Moolenaar <bram@vim.org>
parents:
4839
diff
changeset
|
5 :set noswapfile |
3618 | 6 :if !has('python3') | e! test.ok | wq! test.out | endif |
4425 | 7 :lang C |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
8 :fun Test() |
3618 | 9 :py3 import vim |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
10 :py3 cb = vim.current.buffer |
3618 | 11 :let l = [] |
12 :py3 l=vim.bindeval('l') | |
13 :py3 f=vim.bindeval('function("strlen")') | |
14 :" Extending List directly with different types | |
15 :py3 l+=[1, "as'd", [1, 2, f, {'a': 1}]] | |
16 :$put =string(l) | |
17 :$put =string(l[-1]) | |
18 :try | |
19 : $put =string(l[-4]) | |
20 :catch | |
21 : $put =v:exception[:13] | |
22 :endtry | |
23 :" List assignment | |
24 :py3 l[0]=0 | |
25 :$put =string(l) | |
26 :py3 l[-2]=f | |
27 :$put =string(l) | |
28 :" | |
29 :" Extending Dictionary directly with different types | |
30 :let d = {} | |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
31 :fun d.f() |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
32 : return 1 |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
33 :endfun |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
34 py3 << EOF |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
35 d=vim.bindeval('d') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
36 d['1']='asd' |
5659 | 37 d.update() # Must not do anything, including throwing errors |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
38 d.update(b=[1, 2, f]) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
39 d.update((('-1', {'a': 1}),)) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
40 d.update({'0': -1}) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
41 dk = d.keys() |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
42 dv = d.values() |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
43 di = d.items() |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
44 dk.sort(key=repr) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
45 dv.sort(key=repr) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
46 di.sort(key=repr) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
47 EOF |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
48 :$put =py3eval('d[''f''](self={})') |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
49 :$put =py3eval('repr(dk)') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
50 :$put =substitute(py3eval('repr(dv)'),'0x\x\+','','g') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
51 :$put =substitute(py3eval('repr(di)'),'0x\x\+','','g') |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
52 :for [key, Val] in sort(items(d)) |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
53 : $put =string(key) . ' : ' . string(Val) |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
54 : unlet key Val |
3618 | 55 :endfor |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
56 :py3 del dk |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
57 :py3 del di |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
58 :py3 del dv |
3618 | 59 :" |
60 :" removing items with del | |
61 :py3 del l[2] | |
62 :$put =string(l) | |
63 :let l = range(8) | |
64 :py3 l=vim.bindeval('l') | |
65 :try | |
66 : py3 del l[:3] | |
67 : py3 del l[1:] | |
68 :catch | |
69 : $put =v:exception | |
70 :endtry | |
71 :$put =string(l) | |
72 :" | |
73 :py3 del d['-1'] | |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
74 :py3 del d['f'] |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
75 :$put =string(py3eval('d.get(''b'', 1)')) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
76 :$put =string(py3eval('d.pop(''b'')')) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
77 :$put =string(py3eval('d.get(''b'', 1)')) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
78 :$put =string(py3eval('d.pop(''1'', 2)')) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
79 :$put =string(py3eval('d.pop(''1'', 2)')) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
80 :$put =py3eval('repr(d.has_key(''0''))') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
81 :$put =py3eval('repr(d.has_key(''1''))') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
82 :$put =py3eval('repr(''0'' in d)') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
83 :$put =py3eval('repr(''1'' in d)') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
84 :$put =py3eval('repr(list(iter(d)))') |
3618 | 85 :$put =string(d) |
4698
2db005052371
updated for version 7.3.1096
Bram Moolenaar <bram@vim.org>
parents:
4684
diff
changeset
|
86 :$put =py3eval('repr(d.popitem())') |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
87 :$put =py3eval('repr(d.get(''0''))') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
88 :$put =py3eval('repr(list(iter(d)))') |
3618 | 89 :" |
90 :" removing items out of range: silently skip items that don't exist | |
91 :let l = [0, 1, 2, 3] | |
92 :py3 l=vim.bindeval('l') | |
93 :" The following two ranges delete nothing as they match empty list: | |
94 :py3 del l[2:1] | |
95 :$put =string(l) | |
96 :py3 del l[2:2] | |
97 :$put =string(l) | |
98 :py3 del l[2:3] | |
99 :$put =string(l) | |
100 :let l = [0, 1, 2, 3] | |
101 :py3 l=vim.bindeval('l') | |
102 :py3 del l[2:4] | |
103 :$put =string(l) | |
104 :let l = [0, 1, 2, 3] | |
105 :py3 l=vim.bindeval('l') | |
106 :py3 del l[2:5] | |
107 :$put =string(l) | |
108 :let l = [0, 1, 2, 3] | |
109 :py3 l=vim.bindeval('l') | |
110 :py3 del l[2:6] | |
111 :$put =string(l) | |
112 :let l = [0, 1, 2, 3] | |
113 :py3 l=vim.bindeval('l') | |
114 :" The following two ranges delete nothing as they match empty list: | |
115 :py3 del l[-1:2] | |
116 :$put =string(l) | |
117 :py3 del l[-2:2] | |
118 :$put =string(l) | |
119 :py3 del l[-3:2] | |
120 :$put =string(l) | |
121 :let l = [0, 1, 2, 3] | |
122 :py3 l=vim.bindeval('l') | |
123 :py3 del l[-4:2] | |
124 :$put =string(l) | |
125 :let l = [0, 1, 2, 3] | |
126 :py3 l=vim.bindeval('l') | |
127 :py3 del l[-5:2] | |
128 :$put =string(l) | |
129 :let l = [0, 1, 2, 3] | |
130 :py3 l=vim.bindeval('l') | |
131 :py3 del l[-6:2] | |
132 :$put =string(l) | |
5608 | 133 :let l = [0, 1, 2, 3] |
134 :py3 l=vim.bindeval('l') | |
135 :py3 del l[::2] | |
136 :$put =string(l) | |
137 :let l = [0, 1, 2, 3] | |
138 :py3 l=vim.bindeval('l') | |
139 :py3 del l[3:0:-2] | |
140 :$put =string(l) | |
141 :let l = [0, 1, 2, 3] | |
142 :py3 l=vim.bindeval('l') | |
143 :py3 del l[2:4:-2] | |
144 :$put =string(l) | |
3618 | 145 :" |
146 :" Slice assignment to a list | |
147 :let l = [0, 1, 2, 3] | |
148 :py3 l=vim.bindeval('l') | |
149 :py3 l[0:0]=['a'] | |
150 :$put =string(l) | |
151 :let l = [0, 1, 2, 3] | |
152 :py3 l=vim.bindeval('l') | |
153 :py3 l[1:2]=['b'] | |
154 :$put =string(l) | |
155 :let l = [0, 1, 2, 3] | |
156 :py3 l=vim.bindeval('l') | |
157 :py3 l[2:4]=['c'] | |
158 :$put =string(l) | |
159 :let l = [0, 1, 2, 3] | |
160 :py3 l=vim.bindeval('l') | |
161 :py3 l[4:4]=['d'] | |
162 :$put =string(l) | |
163 :let l = [0, 1, 2, 3] | |
164 :py3 l=vim.bindeval('l') | |
165 :py3 l[-1:2]=['e'] | |
166 :$put =string(l) | |
167 :let l = [0, 1, 2, 3] | |
168 :py3 l=vim.bindeval('l') | |
169 :py3 l[-10:2]=['f'] | |
170 :$put =string(l) | |
171 :let l = [0, 1, 2, 3] | |
172 :py3 l=vim.bindeval('l') | |
173 :py3 l[2:-10]=['g'] | |
174 :$put =string(l) | |
175 :let l = [] | |
176 :py3 l=vim.bindeval('l') | |
177 :py3 l[0:0]=['h'] | |
178 :$put =string(l) | |
5608 | 179 :let l = range(8) |
180 :py3 l=vim.bindeval('l') | |
181 :py3 l[2:6:2] = [10, 20] | |
182 :$put =string(l) | |
183 :let l = range(8) | |
184 :py3 l=vim.bindeval('l') | |
185 :py3 l[6:2:-2] = [10, 20] | |
186 :$put =string(l) | |
187 :let l = range(8) | |
188 :py3 l=vim.bindeval('l') | |
189 :py3 l[6:2] = () | |
190 :$put =string(l) | |
191 :let l = range(8) | |
192 :py3 l=vim.bindeval('l') | |
193 :py3 l[6:2:1] = () | |
194 :$put =string(l) | |
195 :let l = range(8) | |
196 :py3 l=vim.bindeval('l') | |
197 :py3 l[2:2:1] = () | |
198 :$put =string(l) | |
3618 | 199 :" |
200 :" Locked variables | |
201 :let l = [0, 1, 2, 3] | |
202 :py3 l=vim.bindeval('l') | |
203 :lockvar! l | |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
204 py3 << EOF |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
205 def emsg(ei): |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
206 return ei[0].__name__ + ':' + repr(ei[1].args) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
207 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
208 try: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
209 l[2]='i' |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
210 except vim.error: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
211 cb.append('l[2] threw vim.error: ' + emsg(sys.exc_info())) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
212 EOF |
3618 | 213 :$put =string(l) |
214 :unlockvar! l | |
215 :" | |
216 :" Function calls | |
5517 | 217 py3 << EOF |
218 import sys | |
219 import re | |
220 | |
221 py33_type_error_pattern = re.compile('^__call__\(\) takes (\d+) positional argument but (\d+) were given$') | |
222 | |
223 def ee(expr, g=globals(), l=locals()): | |
224 cb = vim.current.buffer | |
225 try: | |
226 try: | |
227 exec(expr, g, l) | |
228 except Exception as e: | |
229 if sys.version_info >= (3, 3) and e.__class__ is AttributeError and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."): | |
230 cb.append(expr + ':' + repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1])))) | |
231 elif sys.version_info >= (3, 3) and e.__class__ is ImportError and str(e).find('No module named \'') >= 0: | |
232 cb.append(expr + ':' + repr((e.__class__, ImportError(str(e).replace("'", ''))))) | |
233 elif sys.version_info >= (3, 3) and e.__class__ is TypeError: | |
234 m = py33_type_error_pattern.search(str(e)) | |
235 if m: | |
236 msg = '__call__() takes exactly {0} positional argument ({1} given)'.format(m.group(1), m.group(2)) | |
237 cb.append(expr + ':' + repr((e.__class__, TypeError(msg)))) | |
238 else: | |
239 cb.append(expr + ':' + repr((e.__class__, e))) | |
8328
0a55dd381410
commit https://github.com/vim/vim/commit/29e1951e14907b62797554ad0cc85cbbe75a1be4
Christian Brabandt <cb@256bit.org>
parents:
7660
diff
changeset
|
240 elif sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': |
10160
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
241 cb.append(expr + ':' + repr((TypeError, TypeError('expected bytes with no null')))) |
5517 | 242 else: |
10160
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
243 msg = repr((e.__class__, e)) |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
244 # Some Python versions say can't, others cannot. |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
245 if msg.find('can\'t') > -1: |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
246 msg = msg.replace('can\'t', 'cannot') |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
247 # Some Python versions use single quote, some double quote |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
248 if msg.find('"cannot ') > -1: |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
249 msg = msg.replace('"cannot ', '\'cannot ') |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
250 if msg.find(' attributes"') > -1: |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
251 msg = msg.replace(' attributes"', ' attributes\'') |
32dd27cceadd
commit https://github.com/vim/vim/commit/cf703fe9d66744ffd7d9c625ee1cbe048ee07740
Christian Brabandt <cb@256bit.org>
parents:
9119
diff
changeset
|
252 cb.append(expr + ':' + msg) |
5517 | 253 else: |
254 cb.append(expr + ':NOT FAILED') | |
255 except Exception as e: | |
256 cb.append(expr + '::' + repr((e.__class__, e))) | |
257 EOF | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
258 :fun New(...) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
259 : return ['NewStart']+a:000+['NewEnd'] |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
260 :endfun |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
261 :fun DictNew(...) dict |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
262 : return ['DictNewStart']+a:000+['DictNewEnd', self] |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
263 :endfun |
3618 | 264 :let l=[function('New'), function('DictNew')] |
265 :py3 l=vim.bindeval('l') | |
266 :py3 l.extend(list(l[0](1, 2, 3))) | |
267 :$put =string(l) | |
268 :py3 l.extend(list(l[1](1, 2, 3, self={'a': 'b'}))) | |
269 :$put =string(l) | |
270 :py3 l+=[l[0].name] | |
271 :$put =string(l) | |
5517 | 272 :py3 ee('l[1](1, 2, 3)') |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
273 :py3 f=l[0] |
3618 | 274 :delfunction New |
5517 | 275 :py3 ee('f(1, 2, 3)') |
3618 | 276 :if has('float') |
277 : let l=[0.0] | |
278 : py3 l=vim.bindeval('l') | |
279 : py3 l.extend([0.0]) | |
280 : $put =string(l) | |
281 :else | |
282 : $put ='[0.0, 0.0]' | |
283 :endif | |
3802 | 284 :let messages=[] |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
285 :delfunction DictNew |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
286 py3 <<EOF |
8328
0a55dd381410
commit https://github.com/vim/vim/commit/29e1951e14907b62797554ad0cc85cbbe75a1be4
Christian Brabandt <cb@256bit.org>
parents:
7660
diff
changeset
|
287 import sys |
3802 | 288 d=vim.bindeval('{}') |
289 m=vim.bindeval('messages') | |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
290 def em(expr, g=globals(), l=locals()): |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
291 try: |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
292 exec(expr, g, l) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
293 except Exception as e: |
8328
0a55dd381410
commit https://github.com/vim/vim/commit/29e1951e14907b62797554ad0cc85cbbe75a1be4
Christian Brabandt <cb@256bit.org>
parents:
7660
diff
changeset
|
294 if sys.version_info >= (3, 5) and e.__class__ is ValueError and str(e) == 'embedded null byte': |
0a55dd381410
commit https://github.com/vim/vim/commit/29e1951e14907b62797554ad0cc85cbbe75a1be4
Christian Brabandt <cb@256bit.org>
parents:
7660
diff
changeset
|
295 m.extend([TypeError.__name__]) |
0a55dd381410
commit https://github.com/vim/vim/commit/29e1951e14907b62797554ad0cc85cbbe75a1be4
Christian Brabandt <cb@256bit.org>
parents:
7660
diff
changeset
|
296 else: |
0a55dd381410
commit https://github.com/vim/vim/commit/29e1951e14907b62797554ad0cc85cbbe75a1be4
Christian Brabandt <cb@256bit.org>
parents:
7660
diff
changeset
|
297 m.extend([e.__class__.__name__]) |
3802 | 298 |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
299 em('d["abc1"]') |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
300 em('d["abc1"]="\\0"') |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
301 em('d["abc1"]=vim') |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
302 em('d[""]=1') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
303 em('d["a\\0b"]=1') |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
304 em('d[b"a\\0b"]=1') |
3802 | 305 |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
306 em('d.pop("abc1")') |
4698
2db005052371
updated for version 7.3.1096
Bram Moolenaar <bram@vim.org>
parents:
4684
diff
changeset
|
307 em('d.popitem()') |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
308 del em |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
309 del m |
3802 | 310 EOF |
311 :$put =messages | |
3828 | 312 :unlet messages |
313 :" locked and scope attributes | |
314 :let d={} | let dl={} | lockvar dl | |
315 :for s in split("d dl v: g:") | |
316 : let name=tr(s, ':', 's') | |
317 : execute 'py3 '.name.'=vim.bindeval("'.s.'")' | |
318 : let toput=s.' : '.join(map(['locked', 'scope'], 'v:val.":".py3eval(name.".".v:val)'), ';') | |
319 : $put =toput | |
320 :endfor | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
321 :silent! let d.abc2=1 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
322 :silent! let dl.abc3=1 |
3828 | 323 :py3 d.locked=True |
324 :py3 dl.locked=False | |
325 :silent! let d.def=1 | |
326 :silent! let dl.def=1 | |
327 :put ='d:'.string(d) | |
328 :put ='dl:'.string(dl) | |
329 :unlet d dl | |
330 : | |
331 :let l=[] | let ll=[] | lockvar ll | |
332 :for s in split("l ll") | |
333 : let name=tr(s, ':', 's') | |
334 : execute 'py3 '.name.'=vim.bindeval("'.s.'")' | |
335 : let toput=s.' : locked:'.py3eval(name.'.locked') | |
336 : $put =toput | |
337 :endfor | |
338 :silent! call extend(l, [0]) | |
339 :silent! call extend(ll, [0]) | |
340 :py3 l.locked=True | |
341 :py3 ll.locked=False | |
342 :silent! call extend(l, [1]) | |
343 :silent! call extend(ll, [1]) | |
344 :put ='l:'.string(l) | |
345 :put ='ll:'.string(ll) | |
346 :unlet l ll | |
3618 | 347 :" |
348 :" py3eval() | |
349 :let l=py3eval('[0, 1, 2]') | |
350 :$put =string(l) | |
351 :let d=py3eval('{"a": "b", "c": 1, "d": ["e"]}') | |
352 :$put =sort(items(d)) | |
7660
066ef357ea91
commit https://github.com/vim/vim/commit/77324fc9d3206a12f5ae39da1574be3ee1273591
Christian Brabandt <cb@256bit.org>
parents:
7376
diff
changeset
|
353 :let v:errmsg = '' |
066ef357ea91
commit https://github.com/vim/vim/commit/77324fc9d3206a12f5ae39da1574be3ee1273591
Christian Brabandt <cb@256bit.org>
parents:
7376
diff
changeset
|
354 :$put ='py3eval(\"None\") = ' . py3eval('None') . v:errmsg |
3618 | 355 :if has('float') |
356 : let f=py3eval('0.0') | |
357 : $put =string(f) | |
358 :else | |
359 : $put ='0.0' | |
360 :endif | |
3802 | 361 :" Invalid values: |
362 :for e in ['"\0"', '{"\0": 1}', 'undefined_name', 'vim'] | |
363 : try | |
364 : let v=py3eval(e) | |
365 : catch | |
366 : let toput=e.":\t".v:exception[:13] | |
367 : $put =toput | |
368 : endtry | |
369 :endfor | |
4109 | 370 :" |
371 :" threading | |
372 :let l = [0] | |
373 :py3 l=vim.bindeval('l') | |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
374 py3 <<EOF |
4109 | 375 import threading |
376 import time | |
377 | |
378 class T(threading.Thread): | |
379 def __init__(self): | |
380 threading.Thread.__init__(self) | |
381 self.t = 0 | |
382 self.running = True | |
383 | |
384 def run(self): | |
385 while self.running: | |
386 self.t += 1 | |
387 time.sleep(0.1) | |
388 | |
389 t = T() | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
390 del T |
4109 | 391 t.start() |
392 EOF | |
393 :sleep 1 | |
394 :py3 t.running = False | |
395 :py3 t.join() | |
7376
88843d12c82b
commit https://github.com/vim/vim/commit/52f6ae1366b34fc5771595c0bd17c779a7f6f544
Christian Brabandt <cb@256bit.org>
parents:
7326
diff
changeset
|
396 :" Check if the background thread is working. Count should be 10, but on a |
88843d12c82b
commit https://github.com/vim/vim/commit/52f6ae1366b34fc5771595c0bd17c779a7f6f544
Christian Brabandt <cb@256bit.org>
parents:
7326
diff
changeset
|
397 :" busy system (AppVeyor) it can be much lower. |
88843d12c82b
commit https://github.com/vim/vim/commit/52f6ae1366b34fc5771595c0bd17c779a7f6f544
Christian Brabandt <cb@256bit.org>
parents:
7326
diff
changeset
|
398 :py3 l[0] = t.t > 4 |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
399 :py3 del time |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
400 :py3 del threading |
5517 | 401 :py3 del t |
4109 | 402 :$put =string(l) |
403 :" | |
404 :" settrace | |
405 :let l = [] | |
406 :py3 l=vim.bindeval('l') | |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
407 py3 <<EOF |
4109 | 408 import sys |
409 | |
410 def traceit(frame, event, arg): | |
411 global l | |
412 if event == "line": | |
413 l += [frame.f_lineno] | |
414 return traceit | |
415 | |
416 def trace_main(): | |
417 for i in range(5): | |
418 pass | |
419 EOF | |
420 :py3 sys.settrace(traceit) | |
421 :py3 trace_main() | |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
422 :py3 sys.settrace(None) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
423 :py3 del traceit |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
424 :py3 del trace_main |
4109 | 425 :$put =string(l) |
4323 | 426 :" |
5608 | 427 :" Slice |
428 :py3 ll = vim.bindeval('[0, 1, 2, 3, 4, 5]') | |
429 :py3 l = ll[:4] | |
430 :$put =string(py3eval('l')) | |
431 :py3 l = ll[2:] | |
432 :$put =string(py3eval('l')) | |
433 :py3 l = ll[:-4] | |
434 :$put =string(py3eval('l')) | |
435 :py3 l = ll[-2:] | |
436 :$put =string(py3eval('l')) | |
437 :py3 l = ll[2:4] | |
438 :$put =string(py3eval('l')) | |
439 :py3 l = ll[4:2] | |
440 :$put =string(py3eval('l')) | |
441 :py3 l = ll[-4:-2] | |
442 :$put =string(py3eval('l')) | |
443 :py3 l = ll[-2:-4] | |
444 :$put =string(py3eval('l')) | |
445 :py3 l = ll[:] | |
446 :$put =string(py3eval('l')) | |
447 :py3 l = ll[0:6] | |
448 :$put =string(py3eval('l')) | |
449 :py3 l = ll[-10:10] | |
450 :$put =string(py3eval('l')) | |
451 :py3 l = ll[4:2:-1] | |
452 :$put =string(py3eval('l')) | |
453 :py3 l = ll[::2] | |
454 :$put =string(py3eval('l')) | |
455 :py3 l = ll[4:2:1] | |
456 :$put =string(py3eval('l')) | |
457 :py3 del l | |
458 :" | |
4323 | 459 :" Vars |
460 :let g:foo = 'bac' | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
461 :let w:abc3 = 'def' |
4323 | 462 :let b:baz = 'bar' |
4413 | 463 :let t:bar = 'jkl' |
4323 | 464 :try |
465 : throw "Abc" | |
466 :catch | |
467 : put =py3eval('vim.vvars[''exception'']') | |
468 :endtry | |
469 :put =py3eval('vim.vars[''foo'']') | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
470 :put =py3eval('vim.current.window.vars[''abc3'']') |
4323 | 471 :put =py3eval('vim.current.buffer.vars[''baz'']') |
4413 | 472 :put =py3eval('vim.current.tabpage.vars[''bar'']') |
4350 | 473 :" |
474 :" Options | |
475 :" paste: boolean, global | |
476 :" previewheight number, global | |
477 :" operatorfunc: string, global | |
478 :" number: boolean, window-local | |
479 :" numberwidth: number, window-local | |
480 :" colorcolumn: string, window-local | |
481 :" statusline: string, window-local/global | |
482 :" autoindent: boolean, buffer-local | |
4427 | 483 :" shiftwidth: number, buffer-local |
4350 | 484 :" omnifunc: string, buffer-local |
485 :" preserveindent: boolean, buffer-local/global | |
486 :" path: string, buffer-local/global | |
487 :let g:bufs=[bufnr('%')] | |
488 :new | |
489 :let g:bufs+=[bufnr('%')] | |
490 :vnew | |
491 :let g:bufs+=[bufnr('%')] | |
492 :wincmd j | |
493 :vnew | |
494 :let g:bufs+=[bufnr('%')] | |
495 :wincmd l | |
496 :fun RecVars(opt) | |
497 : let gval =string(eval('&g:'.a:opt)) | |
498 : let wvals=join(map(range(1, 4), 'v:val.":".string(getwinvar(v:val, "&".a:opt))')) | |
499 : let bvals=join(map(copy(g:bufs), 'v:val.":".string(getbufvar(v:val, "&".a:opt))')) | |
500 : put =' G: '.gval | |
501 : put =' W: '.wvals | |
502 : put =' B: '.wvals | |
503 :endfun | |
504 py3 << EOF | |
505 def e(s, g=globals(), l=locals()): | |
506 try: | |
507 exec(s, g, l) | |
508 except Exception as e: | |
4498 | 509 vim.command('return ' + repr(e.__class__.__name__)) |
4350 | 510 |
511 def ev(s, g=globals(), l=locals()): | |
512 try: | |
513 return eval(s, g, l) | |
514 except Exception as e: | |
4498 | 515 vim.command('let exc=' + repr(e.__class__.__name__)) |
4350 | 516 return 0 |
517 EOF | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
518 :fun E(s) |
4350 | 519 : python3 e(vim.eval('a:s')) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
520 :endfun |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
521 :fun Ev(s) |
4498 | 522 : let r=py3eval('ev(vim.eval("a:s"))') |
523 : if exists('exc') | |
524 : throw exc | |
525 : endif | |
526 : return r | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
527 :endfun |
4350 | 528 :py3 gopts1=vim.options |
529 :py3 wopts1=vim.windows[2].options | |
530 :py3 wopts2=vim.windows[0].options | |
531 :py3 wopts3=vim.windows[1].options | |
532 :py3 bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options | |
533 :py3 bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options | |
534 :py3 bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options | |
5610 | 535 :$put ='wopts iters equal: '.py3eval('list(wopts1) == list(wopts2)') |
536 :$put ='bopts iters equal: '.py3eval('list(bopts1) == list(bopts2)') | |
537 :py3 gset=set(iter(gopts1)) | |
538 :py3 wset=set(iter(wopts1)) | |
539 :py3 bset=set(iter(bopts1)) | |
4684
79522bb17125
updated for version 7.3.1089
Bram Moolenaar <bram@vim.org>
parents:
4663
diff
changeset
|
540 :set path=.,..,, |
4350 | 541 :let lst=[] |
542 :let lst+=[['paste', 1, 0, 1, 2, 1, 1, 0 ]] | |
543 :let lst+=[['previewheight', 5, 1, 6, 'a', 0, 1, 0 ]] | |
544 :let lst+=[['operatorfunc', 'A', 'B', 'C', 2, 0, 1, 0 ]] | |
545 :let lst+=[['number', 0, 1, 1, 0, 1, 0, 1 ]] | |
546 :let lst+=[['numberwidth', 2, 3, 5, -100, 0, 0, 1 ]] | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
547 :let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc4', 0, 0, 1 ]] |
4350 | 548 :let lst+=[['statusline', '1', '2', '4', 0, 0, 1, 1 ]] |
549 :let lst+=[['autoindent', 0, 1, 1, 2, 1, 0, 2 ]] | |
4427 | 550 :let lst+=[['shiftwidth', 0, 2, 1, 3, 0, 0, 2 ]] |
4350 | 551 :let lst+=[['omnifunc', 'A', 'B', 'C', 1, 0, 0, 2 ]] |
552 :let lst+=[['preserveindent', 0, 1, 1, 2, 1, 1, 2 ]] | |
553 :let lst+=[['path', '.,,', ',,', '.', 0, 0, 1, 2 ]] | |
554 :for [oname, oval1, oval2, oval3, invval, bool, global, local] in lst | |
555 : py3 oname=vim.eval('oname') | |
556 : py3 oval1=vim.bindeval('oval1') | |
557 : py3 oval2=vim.bindeval('oval2') | |
558 : py3 oval3=vim.bindeval('oval3') | |
559 : if invval is 0 || invval is 1 | |
560 : py3 invval=bool(vim.bindeval('invval')) | |
561 : else | |
562 : py3 invval=vim.bindeval('invval') | |
563 : endif | |
564 : if bool | |
565 : py3 oval1=bool(oval1) | |
566 : py3 oval2=bool(oval2) | |
567 : py3 oval3=bool(oval3) | |
568 : endif | |
569 : put ='>>> '.oname | |
5610 | 570 : $put =' g/w/b:'.py3eval('oname in gset').'/'.py3eval('oname in wset').'/'.py3eval('oname in bset') |
571 : $put =' g/w/b (in):'.py3eval('oname in gopts1').'/'.py3eval('oname in wopts1').'/'.py3eval('oname in bopts1') | |
4350 | 572 : for v in ['gopts1', 'wopts1', 'bopts1'] |
573 : try | |
574 : put =' p/'.v.': '.Ev('repr('.v.'['''.oname.'''])') | |
575 : catch | |
576 : put =' p/'.v.'! '.v:exception | |
577 : endtry | |
4498 | 578 : let r=E(v.'['''.oname.''']=invval') |
579 : if r isnot 0 | |
580 : put =' inv: '.string(invval).'! '.r | |
581 : endif | |
4350 | 582 : for vv in (v is# 'gopts1' ? [v] : [v, v[:-2].'2', v[:-2].'3']) |
583 : let val=substitute(vv, '^.opts', 'oval', '') | |
4498 | 584 : let r=E(vv.'['''.oname.''']='.val) |
585 : if r isnot 0 | |
586 : put =' '.vv.'! '.r | |
587 : endif | |
4350 | 588 : endfor |
589 : endfor | |
590 : call RecVars(oname) | |
591 : for v in ['wopts3', 'bopts3'] | |
4498 | 592 : let r=E('del '.v.'["'.oname.'"]') |
593 : if r isnot 0 | |
594 : put =' del '.v.'! '.r | |
595 : endif | |
4350 | 596 : endfor |
597 : call RecVars(oname) | |
598 :endfor | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
599 :delfunction RecVars |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
600 :delfunction E |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
601 :delfunction Ev |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
602 :py3 del ev |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
603 :py3 del e |
4350 | 604 :only |
4397 | 605 :for buf in g:bufs[1:] |
606 : execute 'bwipeout!' buf | |
607 :endfor | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
608 :py3 del gopts1 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
609 :py3 del wopts1 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
610 :py3 del wopts2 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
611 :py3 del wopts3 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
612 :py3 del bopts1 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
613 :py3 del bopts2 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
614 :py3 del bopts3 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
615 :py3 del oval1 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
616 :py3 del oval2 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
617 :py3 del oval3 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
618 :py3 del oname |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
619 :py3 del invval |
4389 | 620 :" |
621 :" Test buffer object | |
622 :vnew | |
623 :put ='First line' | |
624 :put ='Second line' | |
625 :put ='Third line' | |
626 :1 delete _ | |
627 :py3 b=vim.current.buffer | |
628 :wincmd w | |
629 :mark a | |
4589
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
630 :augroup BUFS |
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
631 : autocmd BufFilePost * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePost:' + vim.eval('bufnr("%")')) |
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
632 : autocmd BufFilePre * python3 cb.append(vim.eval('expand("<abuf>")') + ':BufFilePre:' + vim.eval('bufnr("%")')) |
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
633 :augroup END |
4389 | 634 py3 << EOF |
635 # Tests BufferAppend and BufferItem | |
636 cb.append(b[0]) | |
637 # Tests BufferSlice and BufferAssSlice | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
638 cb.append('abc5') # Will be overwritten |
4389 | 639 cb[-1:] = b[:-2] |
640 # Test BufferLength and BufferAssSlice | |
641 cb.append('def') # Will not be overwritten | |
642 cb[len(cb):] = b[:] | |
643 # Test BufferAssItem and BufferMark | |
644 cb.append('ghi') # Will be overwritten | |
645 cb[-1] = repr((len(cb) - cb.mark('a')[0], cb.mark('a')[1])) | |
646 # Test BufferRepr | |
647 cb.append(repr(cb) + repr(b)) | |
648 # Modify foreign buffer | |
649 b.append('foo') | |
650 b[0]='bar' | |
651 b[0:0]=['baz'] | |
652 vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number) | |
4589
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
653 # Test assigning to name property |
4684
79522bb17125
updated for version 7.3.1089
Bram Moolenaar <bram@vim.org>
parents:
4663
diff
changeset
|
654 import os |
4589
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
655 old_name = cb.name |
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
656 cb.name = 'foo' |
4684
79522bb17125
updated for version 7.3.1089
Bram Moolenaar <bram@vim.org>
parents:
4663
diff
changeset
|
657 cb.append(cb.name[-11:].replace(os.path.sep, '/')) |
4589
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
658 b.name = 'bar' |
4684
79522bb17125
updated for version 7.3.1089
Bram Moolenaar <bram@vim.org>
parents:
4663
diff
changeset
|
659 cb.append(b.name[-11:].replace(os.path.sep, '/')) |
4589
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
660 cb.name = old_name |
4684
79522bb17125
updated for version 7.3.1089
Bram Moolenaar <bram@vim.org>
parents:
4663
diff
changeset
|
661 cb.append(cb.name[-17:].replace(os.path.sep, '/')) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
662 del old_name |
4389 | 663 # Test CheckBuffer |
4589
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
664 for _b in vim.buffers: |
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
665 if _b is not cb: |
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
666 vim.command('bwipeout! ' + str(_b.number)) |
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
667 del _b |
4593
0cf552b325b5
updated for version 7.3.1044
Bram Moolenaar <bram@vim.org>
parents:
4589
diff
changeset
|
668 cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid))) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
669 for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc6")'): |
4389 | 670 try: |
671 exec(expr) | |
672 except vim.error: | |
673 pass | |
674 else: | |
675 # Usually a SEGV here | |
676 # Should not happen in any case | |
677 cb.append('No exception for ' + expr) | |
4589
fa39483a1363
updated for version 7.3.1042
Bram Moolenaar <bram@vim.org>
parents:
4511
diff
changeset
|
678 vim.command('cd .') |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
679 del b |
4389 | 680 EOF |
4397 | 681 :" |
682 :" Test vim.buffers object | |
683 :set hidden | |
684 :edit a | |
685 :buffer # | |
686 :edit b | |
687 :buffer # | |
688 :edit c | |
689 :buffer # | |
690 py3 << EOF | |
691 # Check GCing iterator that was not fully exhausted | |
692 i = iter(vim.buffers) | |
693 cb.append('i:' + str(next(i))) | |
5700 | 694 # and also check creating more than one iterator at a time |
4397 | 695 i2 = iter(vim.buffers) |
696 cb.append('i2:' + str(next(i2))) | |
697 cb.append('i:' + str(next(i))) | |
698 # The following should trigger GC and not cause any problems | |
699 del i | |
700 del i2 | |
701 i3 = iter(vim.buffers) | |
702 cb.append('i3:' + str(next(i3))) | |
703 del i3 | |
704 | |
705 prevnum = 0 | |
706 for b in vim.buffers: | |
707 # Check buffer order | |
708 if prevnum >= b.number: | |
709 cb.append('!!! Buffer numbers not in strictly ascending order') | |
710 # Check indexing: vim.buffers[number].number == number | |
711 cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + '=' + repr(b)) | |
712 prevnum = b.number | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
713 del prevnum |
4397 | 714 |
715 cb.append(str(len(vim.buffers))) | |
716 | |
717 bnums = list(map(lambda b: b.number, vim.buffers))[1:] | |
718 | |
719 # Test wiping out buffer with existing iterator | |
720 i4 = iter(vim.buffers) | |
721 cb.append('i4:' + str(next(i4))) | |
722 vim.command('bwipeout! ' + str(bnums.pop(0))) | |
723 try: | |
724 next(i4) | |
725 except vim.error: | |
726 pass | |
727 else: | |
728 cb.append('!!!! No vim.error') | |
729 i4 = iter(vim.buffers) | |
730 vim.command('bwipeout! ' + str(bnums.pop(-1))) | |
731 vim.command('bwipeout! ' + str(bnums.pop(-1))) | |
732 cb.append('i4:' + str(next(i4))) | |
733 try: | |
734 next(i4) | |
735 except StopIteration: | |
736 cb.append('StopIteration') | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
737 del i4 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
738 del bnums |
4397 | 739 EOF |
4413 | 740 :" |
741 :" Test vim.{tabpage,window}list and vim.{tabpage,window} objects | |
742 :tabnew 0 | |
743 :tabnew 1 | |
744 :vnew a.1 | |
745 :tabnew 2 | |
746 :vnew a.2 | |
747 :vnew b.2 | |
748 :vnew c.2 | |
749 py3 << EOF | |
4511
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
750 cb.append('Number of tabs: ' + str(len(vim.tabpages))) |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
751 cb.append('Current tab pages:') |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
752 |
4413 | 753 def W(w): |
754 if '(unknown)' in repr(w): | |
755 return '<window object (unknown)>' | |
756 else: | |
757 return repr(w) | |
4511
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
758 |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
759 def Cursor(w, start=len(cb)): |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
760 if w.buffer is cb: |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
761 return repr((start - w.cursor[0], w.cursor[1])) |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
762 else: |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
763 return repr(w.cursor) |
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
764 |
4413 | 765 for t in vim.tabpages: |
766 cb.append(' ' + repr(t) + '(' + str(t.number) + ')' + ': ' + str(len(t.windows)) + ' windows, current is ' + W(t.window)) | |
767 cb.append(' Windows:') | |
768 for w in t.windows: | |
4511
ce94a870b59b
updated for version 7.3.1003
Bram Moolenaar <bram@vim.org>
parents:
4498
diff
changeset
|
769 cb.append(' ' + W(w) + '(' + str(w.number) + ')' + ': displays buffer ' + repr(w.buffer) + '; cursor is at ' + Cursor(w)) |
4413 | 770 # Other values depend on the size of the terminal, so they are checked partly: |
771 for attr in ('height', 'row', 'width', 'col'): | |
772 try: | |
773 aval = getattr(w, attr) | |
774 if type(aval) is not int: | |
775 raise TypeError | |
776 if aval < 0: | |
777 raise ValueError | |
778 except Exception as e: | |
779 cb.append('!!!!!! Error while getting attribute ' + attr + ': ' + e.__class__.__name__) | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
780 del aval |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
781 del attr |
4413 | 782 w.cursor = (len(w.buffer), 0) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
783 del W |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
784 del Cursor |
4413 | 785 cb.append('Number of windows in current tab page: ' + str(len(vim.windows))) |
786 if list(vim.windows) != list(vim.current.tabpage.windows): | |
787 cb.append('!!!!!! Windows differ') | |
788 EOF | |
789 :" | |
790 :" Test vim.current | |
791 py3 << EOF | |
792 def H(o): | |
793 return repr(o) | |
794 cb.append('Current tab page: ' + repr(vim.current.tabpage)) | |
795 cb.append('Current window: ' + repr(vim.current.window) + ': ' + H(vim.current.window) + ' is ' + H(vim.current.tabpage.window)) | |
796 cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ ' is ' + H(vim.current.tabpage.window.buffer)) | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
797 del H |
4413 | 798 # Assigning: fails |
799 try: | |
800 vim.current.window = vim.tabpages[0].window | |
801 except ValueError: | |
802 cb.append('ValueError at assigning foreign tab window') | |
803 | |
804 for attr in ('window', 'tabpage', 'buffer'): | |
805 try: | |
806 setattr(vim.current, attr, None) | |
807 except TypeError: | |
808 cb.append('Type error at assigning None to vim.current.' + attr) | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
809 del attr |
4413 | 810 |
811 # Assigning: success | |
812 vim.current.tabpage = vim.tabpages[-2] | |
813 vim.current.buffer = cb | |
814 vim.current.window = vim.windows[0] | |
815 vim.current.window.cursor = (len(vim.current.buffer), 0) | |
816 cb.append('Current tab page: ' + repr(vim.current.tabpage)) | |
817 cb.append('Current window: ' + repr(vim.current.window)) | |
818 cb.append('Current buffer: ' + repr(vim.current.buffer)) | |
819 cb.append('Current line: ' + repr(vim.current.line)) | |
4593
0cf552b325b5
updated for version 7.3.1044
Bram Moolenaar <bram@vim.org>
parents:
4589
diff
changeset
|
820 ws = list(vim.windows) |
0cf552b325b5
updated for version 7.3.1044
Bram Moolenaar <bram@vim.org>
parents:
4589
diff
changeset
|
821 ts = list(vim.tabpages) |
4413 | 822 for b in vim.buffers: |
823 if b is not cb: | |
824 vim.command('bwipeout! ' + str(b.number)) | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
825 del b |
4593
0cf552b325b5
updated for version 7.3.1044
Bram Moolenaar <bram@vim.org>
parents:
4589
diff
changeset
|
826 cb.append('w.valid: ' + repr([w.valid for w in ws])) |
0cf552b325b5
updated for version 7.3.1044
Bram Moolenaar <bram@vim.org>
parents:
4589
diff
changeset
|
827 cb.append('t.valid: ' + repr([t.valid for t in ts])) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
828 del w |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
829 del t |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
830 del ts |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
831 del ws |
4413 | 832 EOF |
833 :tabonly! | |
834 :only! | |
4496 | 835 :" |
836 :" Test types | |
837 py3 << EOF | |
838 for expr, attr in ( | |
839 ('vim.vars', 'Dictionary'), | |
840 ('vim.options', 'Options'), | |
841 ('vim.bindeval("{}")', 'Dictionary'), | |
842 ('vim.bindeval("[]")', 'List'), | |
843 ('vim.bindeval("function(\'tr\')")', 'Function'), | |
844 ('vim.current.buffer', 'Buffer'), | |
845 ('vim.current.range', 'Range'), | |
846 ('vim.current.window', 'Window'), | |
847 ('vim.current.tabpage', 'TabPage'), | |
848 ): | |
849 cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr))) | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
850 del expr |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
851 del attr |
4496 | 852 EOF |
4498 | 853 :" |
4599
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
854 :" Test __dir__() method |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
855 py3 << EOF |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
856 for name, o in ( |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
857 ('current', vim.current), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
858 ('buffer', vim.current.buffer), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
859 ('window', vim.current.window), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
860 ('tabpage', vim.current.tabpage), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
861 ('range', vim.current.range), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
862 ('dictionary', vim.bindeval('{}')), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
863 ('list', vim.bindeval('[]')), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
864 ('function', vim.bindeval('function("tr")')), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
865 ('output', sys.stdout), |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
866 ): |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
867 cb.append(name + ':' + ','.join(dir(o))) |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
868 del name |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
869 del o |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
870 EOF |
89bec74fd793
updated for version 7.3.1047
Bram Moolenaar <bram@vim.org>
parents:
4593
diff
changeset
|
871 :" |
4629
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
872 :" Test vim.*.__new__ |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
873 :$put =string(py3eval('vim.Dictionary({})')) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
874 :$put =string(py3eval('vim.Dictionary(a=1)')) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
875 :$put =string(py3eval('vim.Dictionary(((''a'', 1),))')) |
4629
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
876 :$put =string(py3eval('vim.List()')) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
877 :$put =string(py3eval('vim.List(iter(''abc7''))')) |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
878 :$put =string(py3eval('vim.Function(''tr'')')) |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
879 :$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4])')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
880 :$put =string(py3eval('vim.Function(''tr'', args=[])')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
881 :$put =string(py3eval('vim.Function(''tr'', self={})')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
882 :$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4], self={})')) |
9119
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
883 :$put ='auto_rebind' |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
884 :$put =string(py3eval('vim.Function(''tr'', auto_rebind=False)')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
885 :$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4], auto_rebind=False)')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
886 :$put =string(py3eval('vim.Function(''tr'', args=[], auto_rebind=False)')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
887 :$put =string(py3eval('vim.Function(''tr'', self={}, auto_rebind=False)')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
888 :$put =string(py3eval('vim.Function(''tr'', args=[123, 3, 4], self={}, auto_rebind=False)')) |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
889 :" |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
890 :" Test vim.Function |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
891 :function Args(...) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
892 : return a:000 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
893 :endfunction |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
894 :function SelfArgs(...) dict |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
895 : return [a:000, self] |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
896 :endfunction |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
897 :" The following four lines should not crash |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
898 :let Pt = function('tr', [[]], {'l': []}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
899 :py3 Pt = vim.bindeval('Pt') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
900 :unlet Pt |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
901 :py3 del Pt |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
902 py3 << EOF |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
903 def ecall(out_prefix, func, *args, **kwargs): |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
904 line = out_prefix + ': ' |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
905 try: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
906 ret = func(*args, **kwargs) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
907 except Exception: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
908 line += '!exception: ' + emsg(sys.exc_info()) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
909 else: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
910 line += '!result: ' + str(vim.Function('string')(ret), 'utf-8') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
911 cb.append(line) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
912 a = vim.Function('Args') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
913 pa1 = vim.Function('Args', args=['abcArgsPA1']) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
914 pa2 = vim.Function('Args', args=[]) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
915 pa3 = vim.Function('Args', args=['abcArgsPA3'], self={'abcSelfPA3': 'abcSelfPA3Val'}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
916 pa4 = vim.Function('Args', self={'abcSelfPA4': 'abcSelfPA4Val'}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
917 cb.append('a: ' + repr(a)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
918 cb.append('pa1: ' + repr(pa1)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
919 cb.append('pa2: ' + repr(pa2)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
920 cb.append('pa3: ' + repr(pa3)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
921 cb.append('pa4: ' + repr(pa4)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
922 sa = vim.Function('SelfArgs') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
923 psa1 = vim.Function('SelfArgs', args=['abcArgsPSA1']) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
924 psa2 = vim.Function('SelfArgs', args=[]) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
925 psa3 = vim.Function('SelfArgs', args=['abcArgsPSA3'], self={'abcSelfPSA3': 'abcSelfPSA3Val'}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
926 psa4 = vim.Function('SelfArgs', self={'abcSelfPSA4': 'abcSelfPSA4Val'}) |
9119
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
927 psa5 = vim.Function('SelfArgs', self={'abcSelfPSA5': 'abcSelfPSA5Val'}, auto_rebind=0) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
928 psa6 = vim.Function('SelfArgs', args=['abcArgsPSA6'], self={'abcSelfPSA6': 'abcSelfPSA6Val'}, auto_rebind=()) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
929 psa7 = vim.Function('SelfArgs', args=['abcArgsPSA7'], auto_rebind=[]) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
930 psa8 = vim.Function('SelfArgs', auto_rebind=False) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
931 psa9 = vim.Function('SelfArgs', self={'abcSelfPSA9': 'abcSelfPSA9Val'}, auto_rebind=True) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
932 psaA = vim.Function('SelfArgs', args=['abcArgsPSAA'], self={'abcSelfPSAA': 'abcSelfPSAAVal'}, auto_rebind=1) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
933 psaB = vim.Function('SelfArgs', args=['abcArgsPSAB'], auto_rebind={'abcARPSAB': 'abcARPSABVal'}) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
934 psaC = vim.Function('SelfArgs', auto_rebind=['abcARPSAC']) |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
935 cb.append('sa: ' + repr(sa)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
936 cb.append('psa1: ' + repr(psa1)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
937 cb.append('psa2: ' + repr(psa2)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
938 cb.append('psa3: ' + repr(psa3)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
939 cb.append('psa4: ' + repr(psa4)) |
9119
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
940 cb.append('psa5: ' + repr(psa5)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
941 cb.append('psa6: ' + repr(psa6)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
942 cb.append('psa7: ' + repr(psa7)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
943 cb.append('psa8: ' + repr(psa8)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
944 cb.append('psa9: ' + repr(psa9)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
945 cb.append('psaA: ' + repr(psaA)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
946 cb.append('psaB: ' + repr(psaB)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
947 cb.append('psaC: ' + repr(psaC)) |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
948 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
949 psar = vim.Function('SelfArgs', args=[{'abcArgsPSAr': 'abcArgsPSArVal'}], self={'abcSelfPSAr': 'abcSelfPSArVal'}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
950 psar.args[0]['abcArgsPSAr2'] = [psar.self, psar.args[0]] |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
951 psar.self['rec'] = psar |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
952 psar.self['self'] = psar.self |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
953 psar.self['args'] = psar.args |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
954 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
955 try: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
956 cb.append('psar: ' + repr(psar)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
957 except Exception: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
958 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
959 EOF |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
960 :$put ='s(a): '.string(py3eval('a')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
961 :$put ='s(pa1): '.string(py3eval('pa1')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
962 :$put ='s(pa2): '.string(py3eval('pa2')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
963 :$put ='s(pa3): '.string(py3eval('pa3')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
964 :$put ='s(pa4): '.string(py3eval('pa4')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
965 :$put ='s(sa): '.string(py3eval('sa')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
966 :$put ='s(psa1): '.string(py3eval('psa1')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
967 :$put ='s(psa2): '.string(py3eval('psa2')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
968 :$put ='s(psa3): '.string(py3eval('psa3')) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
969 :$put ='s(psa4): '.string(py3eval('psa4')) |
9119
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
970 :$put ='s(psa5): '.string(py3eval('psa5')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
971 :$put ='s(psa6): '.string(py3eval('psa6')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
972 :$put ='s(psa7): '.string(py3eval('psa7')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
973 :$put ='s(psa8): '.string(py3eval('psa8')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
974 :$put ='s(psa9): '.string(py3eval('psa9')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
975 :$put ='s(psaA): '.string(py3eval('psaA')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
976 :$put ='s(psaB): '.string(py3eval('psaB')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
977 :$put ='s(psaC): '.string(py3eval('psaC')) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
978 : |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
979 :for v in ['sa', 'psa1', 'psa2', 'psa3', 'psa4', 'psa5', 'psa6', 'psa7', 'psa8', 'psa9', 'psaA', 'psaB', 'psaC'] |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
980 : let d = {'f': py3eval(v)} |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
981 : $put ='d.'.v.'(): '.string(d.f()) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
982 :endfor |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
983 : |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
984 :py3 ecall('a()', a, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
985 :py3 ecall('pa1()', pa1, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
986 :py3 ecall('pa2()', pa2, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
987 :py3 ecall('pa3()', pa3, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
988 :py3 ecall('pa4()', pa4, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
989 :py3 ecall('sa()', sa, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
990 :py3 ecall('psa1()', psa1, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
991 :py3 ecall('psa2()', psa2, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
992 :py3 ecall('psa3()', psa3, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
993 :py3 ecall('psa4()', psa4, ) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
994 : |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
995 :py3 ecall('a(42, 43)', a, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
996 :py3 ecall('pa1(42, 43)', pa1, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
997 :py3 ecall('pa2(42, 43)', pa2, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
998 :py3 ecall('pa3(42, 43)', pa3, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
999 :py3 ecall('pa4(42, 43)', pa4, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1000 :py3 ecall('sa(42, 43)', sa, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1001 :py3 ecall('psa1(42, 43)', psa1, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1002 :py3 ecall('psa2(42, 43)', psa2, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1003 :py3 ecall('psa3(42, 43)', psa3, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1004 :py3 ecall('psa4(42, 43)', psa4, 42, 43) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1005 : |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1006 :py3 ecall('a(42, self={"20": 1})', a, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1007 :py3 ecall('pa1(42, self={"20": 1})', pa1, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1008 :py3 ecall('pa2(42, self={"20": 1})', pa2, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1009 :py3 ecall('pa3(42, self={"20": 1})', pa3, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1010 :py3 ecall('pa4(42, self={"20": 1})', pa4, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1011 :py3 ecall('sa(42, self={"20": 1})', sa, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1012 :py3 ecall('psa1(42, self={"20": 1})', psa1, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1013 :py3 ecall('psa2(42, self={"20": 1})', psa2, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1014 :py3 ecall('psa3(42, self={"20": 1})', psa3, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1015 :py3 ecall('psa4(42, self={"20": 1})', psa4, 42, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1016 : |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1017 :py3 ecall('a(self={"20": 1})', a, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1018 :py3 ecall('pa1(self={"20": 1})', pa1, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1019 :py3 ecall('pa2(self={"20": 1})', pa2, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1020 :py3 ecall('pa3(self={"20": 1})', pa3, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1021 :py3 ecall('pa4(self={"20": 1})', pa4, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1022 :py3 ecall('sa(self={"20": 1})', sa, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1023 :py3 ecall('psa1(self={"20": 1})', psa1, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1024 :py3 ecall('psa2(self={"20": 1})', psa2, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1025 :py3 ecall('psa3(self={"20": 1})', psa3, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1026 :py3 ecall('psa4(self={"20": 1})', psa4, self={'20': 1}) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1027 py3 << EOF |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1028 def s(v): |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1029 if v is None: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1030 return repr(v) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1031 else: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1032 return str(vim.Function('string')(v), 'utf-8') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1033 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1034 cb.append('a.args: ' + s(a.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1035 cb.append('pa1.args: ' + s(pa1.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1036 cb.append('pa2.args: ' + s(pa2.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1037 cb.append('pa3.args: ' + s(pa3.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1038 cb.append('pa4.args: ' + s(pa4.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1039 cb.append('sa.args: ' + s(sa.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1040 cb.append('psa1.args: ' + s(psa1.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1041 cb.append('psa2.args: ' + s(psa2.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1042 cb.append('psa3.args: ' + s(psa3.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1043 cb.append('psa4.args: ' + s(psa4.args)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1044 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1045 cb.append('a.self: ' + s(a.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1046 cb.append('pa1.self: ' + s(pa1.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1047 cb.append('pa2.self: ' + s(pa2.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1048 cb.append('pa3.self: ' + s(pa3.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1049 cb.append('pa4.self: ' + s(pa4.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1050 cb.append('sa.self: ' + s(sa.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1051 cb.append('psa1.self: ' + s(psa1.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1052 cb.append('psa2.self: ' + s(psa2.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1053 cb.append('psa3.self: ' + s(psa3.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1054 cb.append('psa4.self: ' + s(psa4.self)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1055 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1056 cb.append('a.name: ' + s(a.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1057 cb.append('pa1.name: ' + s(pa1.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1058 cb.append('pa2.name: ' + s(pa2.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1059 cb.append('pa3.name: ' + s(pa3.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1060 cb.append('pa4.name: ' + s(pa4.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1061 cb.append('sa.name: ' + s(sa.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1062 cb.append('psa1.name: ' + s(psa1.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1063 cb.append('psa2.name: ' + s(psa2.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1064 cb.append('psa3.name: ' + s(psa3.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1065 cb.append('psa4.name: ' + s(psa4.name)) |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1066 |
9119
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1067 cb.append('a.auto_rebind: ' + s(a.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1068 cb.append('pa1.auto_rebind: ' + s(pa1.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1069 cb.append('pa2.auto_rebind: ' + s(pa2.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1070 cb.append('pa3.auto_rebind: ' + s(pa3.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1071 cb.append('pa4.auto_rebind: ' + s(pa4.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1072 cb.append('sa.auto_rebind: ' + s(sa.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1073 cb.append('psa1.auto_rebind: ' + s(psa1.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1074 cb.append('psa2.auto_rebind: ' + s(psa2.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1075 cb.append('psa3.auto_rebind: ' + s(psa3.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1076 cb.append('psa4.auto_rebind: ' + s(psa4.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1077 cb.append('psa5.auto_rebind: ' + s(psa5.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1078 cb.append('psa6.auto_rebind: ' + s(psa6.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1079 cb.append('psa7.auto_rebind: ' + s(psa7.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1080 cb.append('psa8.auto_rebind: ' + s(psa8.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1081 cb.append('psa9.auto_rebind: ' + s(psa9.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1082 cb.append('psaA.auto_rebind: ' + s(psaA.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1083 cb.append('psaB.auto_rebind: ' + s(psaB.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1084 cb.append('psaC.auto_rebind: ' + s(psaC.auto_rebind)) |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1085 |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1086 del s |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1087 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1088 del a |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1089 del pa1 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1090 del pa2 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1091 del pa3 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1092 del pa4 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1093 del sa |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1094 del psa1 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1095 del psa2 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1096 del psa3 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1097 del psa4 |
9119
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1098 del psa5 |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1099 del psa6 |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1100 del psa7 |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1101 del psa8 |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1102 del psa9 |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1103 del psaA |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1104 del psaB |
39cc63e8df7c
commit https://github.com/vim/vim/commit/2177f9fe18a927ef65ccebb0856722a28dc00252
Christian Brabandt <cb@256bit.org>
parents:
8967
diff
changeset
|
1105 del psaC |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1106 del psar |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1107 |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1108 del ecall |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1109 EOF |
4619
90beab957ba9
updated for version 7.3.1057
Bram Moolenaar <bram@vim.org>
parents:
4599
diff
changeset
|
1110 :" |
90beab957ba9
updated for version 7.3.1057
Bram Moolenaar <bram@vim.org>
parents:
4599
diff
changeset
|
1111 :" Test stdout/stderr |
90beab957ba9
updated for version 7.3.1057
Bram Moolenaar <bram@vim.org>
parents:
4599
diff
changeset
|
1112 :redir => messages |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1113 :py3 sys.stdout.write('abc8') ; sys.stdout.write('def') |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1114 :py3 sys.stderr.write('abc9') ; sys.stderr.write('def') |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1115 :py3 sys.stdout.writelines(iter('abcA')) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1116 :py3 sys.stderr.writelines(iter('abcB')) |
4619
90beab957ba9
updated for version 7.3.1057
Bram Moolenaar <bram@vim.org>
parents:
4599
diff
changeset
|
1117 :redir END |
90beab957ba9
updated for version 7.3.1057
Bram Moolenaar <bram@vim.org>
parents:
4599
diff
changeset
|
1118 :$put =string(substitute(messages, '\d\+', '', 'g')) |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1119 :" Test subclassing |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1120 :fun Put(...) |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1121 : $put =string(a:000) |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1122 : return a:000 |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1123 :endfun |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1124 py3 << EOF |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1125 class DupDict(vim.Dictionary): |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1126 def __setitem__(self, key, value): |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1127 super(DupDict, self).__setitem__(key, value) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1128 super(DupDict, self).__setitem__('dup_' + key, value) |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1129 dd = DupDict() |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1130 dd['a'] = 'b' |
4629
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1131 |
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1132 class DupList(vim.List): |
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1133 def __getitem__(self, idx): |
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1134 return [super(DupList, self).__getitem__(idx)] * 2 |
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1135 |
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1136 dl = DupList() |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1137 dl2 = DupList(iter('abcC')) |
4629
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1138 dl.extend(dl2[0]) |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1139 |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1140 class DupFun(vim.Function): |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1141 def __call__(self, arg): |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1142 return super(DupFun, self).__call__(arg, arg) |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1143 |
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1144 df = DupFun('Put') |
4627
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1145 EOF |
18ba89e06fab
updated for version 7.3.1061
Bram Moolenaar <bram@vim.org>
parents:
4619
diff
changeset
|
1146 :$put =string(sort(keys(py3eval('dd')))) |
4629
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1147 :$put =string(py3eval('dl')) |
e4e48d4ee040
updated for version 7.3.1062
Bram Moolenaar <bram@vim.org>
parents:
4627
diff
changeset
|
1148 :$put =string(py3eval('dl2')) |
4631
4157fef7b950
updated for version 7.3.1063
Bram Moolenaar <bram@vim.org>
parents:
4629
diff
changeset
|
1149 :$put =string(py3eval('df(2)')) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1150 :$put =string(py3eval('dl') is# py3eval('dl')) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1151 :$put =string(py3eval('dd') is# py3eval('dd')) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1152 :$put =string(py3eval('df')) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1153 :delfunction Put |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1154 py3 << EOF |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1155 del DupDict |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1156 del DupList |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1157 del DupFun |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1158 del dd |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1159 del dl |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1160 del dl2 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1161 del df |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1162 EOF |
4619
90beab957ba9
updated for version 7.3.1057
Bram Moolenaar <bram@vim.org>
parents:
4599
diff
changeset
|
1163 :" |
4704
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1164 :" Test chdir |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1165 py3 << EOF |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1166 import os |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1167 fnamemodify = vim.Function('fnamemodify') |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1168 cb.append(str(fnamemodify('.', ':p:h:t'))) |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1169 cb.append(vim.eval('@%')) |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1170 os.chdir('..') |
7318
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1171 path = fnamemodify('.', ':p:h:t') |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1172 if path != b'src': |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1173 # Running tests from a shadow directory, so move up another level |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1174 # This will result in @% looking like shadow/testdir/test87.in, hence the |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1175 # slicing to remove the leading path and path separator |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1176 os.chdir('..') |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1177 cb.append(str(fnamemodify('.', ':p:h:t'))) |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1178 cb.append(vim.eval('@%')[len(path)+1:].replace(os.path.sep, '/')) |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1179 os.chdir(path) |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1180 else: |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1181 cb.append(str(fnamemodify('.', ':p:h:t'))) |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1182 cb.append(vim.eval('@%').replace(os.path.sep, '/')) |
de124c05fe4f
commit https://github.com/vim/vim/commit/91376b63877c113fe9a3fff2c1b04bf9504f447f
Christian Brabandt <cb@256bit.org>
parents:
7191
diff
changeset
|
1183 del path |
4704
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1184 os.chdir('testdir') |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1185 cb.append(str(fnamemodify('.', ':p:h:t'))) |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1186 cb.append(vim.eval('@%')) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1187 del fnamemodify |
4704
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1188 EOF |
542af01979be
updated for version 7.3.1099
Bram Moolenaar <bram@vim.org>
parents:
4698
diff
changeset
|
1189 :" |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1190 :" Test errors |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1191 :fun F() dict |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1192 :endfun |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1193 :fun D() |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1194 :endfun |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1195 py3 << EOF |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1196 d = vim.Dictionary() |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1197 ned = vim.Dictionary(foo='bar', baz='abcD') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1198 dl = vim.Dictionary(a=1) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1199 dl.locked = True |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1200 l = vim.List() |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1201 ll = vim.List('abcE') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1202 ll.locked = True |
5608 | 1203 nel = vim.List('abcO') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1204 f = vim.Function('string') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1205 fd = vim.Function('F') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1206 fdel = vim.Function('D') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1207 vim.command('delfunction D') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1208 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1209 def subexpr_test(expr, name, subexprs): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1210 cb.append('>>> Testing %s using %s' % (name, expr)) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1211 for subexpr in subexprs: |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1212 ee(expr % subexpr) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1213 cb.append('<<< Finished') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1214 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1215 def stringtochars_test(expr): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1216 return subexpr_test(expr, 'StringToChars', ( |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1217 '1', # Fail type checks |
4663
bce2051173f0
updated for version 7.3.1079
Bram Moolenaar <bram@vim.org>
parents:
4645
diff
changeset
|
1218 'b"\\0"', # Fail PyString_AsStringAndSize(object, , NULL) check |
bce2051173f0
updated for version 7.3.1079
Bram Moolenaar <bram@vim.org>
parents:
4645
diff
changeset
|
1219 '"\\0"', # Fail PyString_AsStringAndSize(bytes, , NULL) check |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1220 )) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1221 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1222 class Mapping(object): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1223 def __init__(self, d): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1224 self.d = d |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1225 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1226 def __getitem__(self, key): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1227 return self.d[key] |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1228 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1229 def keys(self): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1230 return self.d.keys() |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1231 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1232 def items(self): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1233 return self.d.items() |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1234 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1235 def convertfrompyobject_test(expr, recurse=True): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1236 # pydict_to_tv |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1237 stringtochars_test(expr % '{%s : 1}') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1238 if recurse: |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1239 convertfrompyobject_test(expr % '{"abcF" : %s}', False) |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1240 # pymap_to_tv |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1241 stringtochars_test(expr % 'Mapping({%s : 1})') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1242 if recurse: |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1243 convertfrompyobject_test(expr % 'Mapping({"abcG" : %s})', False) |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1244 # pyseq_to_tv |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1245 iter_test(expr) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1246 return subexpr_test(expr, 'ConvertFromPyObject', ( |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1247 'None', # Not conversible |
4706
bf917ee1fad2
updated for version 7.3.1100
Bram Moolenaar <bram@vim.org>
parents:
4704
diff
changeset
|
1248 '{b"": 1}', # Empty key not allowed |
bf917ee1fad2
updated for version 7.3.1100
Bram Moolenaar <bram@vim.org>
parents:
4704
diff
changeset
|
1249 '{"": 1}', # Same, but with unicode object |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1250 'FailingMapping()', # |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1251 'FailingMappingKey()', # |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1252 'FailingNumber()', # |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1253 )) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1254 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1255 def convertfrompymapping_test(expr): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1256 convertfrompyobject_test(expr) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1257 return subexpr_test(expr, 'ConvertFromPyMapping', ( |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1258 '[]', |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1259 )) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1260 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1261 def iter_test(expr): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1262 return subexpr_test(expr, '*Iter*', ( |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1263 'FailingIter()', |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1264 'FailingIterNext()', |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1265 )) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1266 |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1267 def number_test(expr, natural=False, unsigned=False): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1268 if natural: |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1269 unsigned = True |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1270 return subexpr_test(expr, 'NumberToLong', ( |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1271 '[]', |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1272 'None', |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1273 ) + (('-1',) if unsigned else ()) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1274 + (('0',) if natural else ())) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1275 |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1276 class FailingTrue(object): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1277 def __bool__(self): |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1278 raise NotImplementedError('bool') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1279 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1280 class FailingIter(object): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1281 def __iter__(self): |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1282 raise NotImplementedError('iter') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1283 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1284 class FailingIterNext(object): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1285 def __iter__(self): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1286 return self |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1287 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1288 def __next__(self): |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1289 raise NotImplementedError('next') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1290 |
5608 | 1291 class FailingIterNextN(object): |
1292 def __init__(self, n): | |
1293 self.n = n | |
1294 | |
1295 def __iter__(self): | |
1296 return self | |
1297 | |
1298 def __next__(self): | |
1299 if self.n: | |
1300 self.n -= 1 | |
1301 return 1 | |
1302 else: | |
1303 raise NotImplementedError('next N') | |
1304 | |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1305 class FailingMappingKey(object): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1306 def __getitem__(self, item): |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1307 raise NotImplementedError('getitem:mappingkey') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1308 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1309 def keys(self): |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1310 return list("abcH") |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1311 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1312 class FailingMapping(object): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1313 def __getitem__(self): |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1314 raise NotImplementedError('getitem:mapping') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1315 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1316 def keys(self): |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1317 raise NotImplementedError('keys') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1318 |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1319 class FailingList(list): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1320 def __getitem__(self, idx): |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1321 if i == 2: |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1322 raise NotImplementedError('getitem:list') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1323 else: |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1324 return super(FailingList, self).__getitem__(idx) |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1325 |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1326 class NoArgsCall(object): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1327 def __call__(self): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1328 pass |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1329 |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1330 class FailingCall(object): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1331 def __call__(self, path): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1332 raise NotImplementedError('call') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1333 |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1334 class FailingNumber(object): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1335 def __int__(self): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1336 raise NotImplementedError('int') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1337 |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1338 cb.append("> Output") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1339 cb.append(">> OutputSetattr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1340 ee('del sys.stdout.softspace') |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1341 number_test('sys.stdout.softspace = %s', unsigned=True) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1342 number_test('sys.stderr.softspace = %s', unsigned=True) |
7191
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1343 ee('assert sys.stdout.isatty()==False') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1344 ee('assert sys.stdout.seekable()==False') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1345 ee('sys.stdout.close()') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1346 ee('sys.stdout.flush()') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1347 ee('assert sys.stderr.isatty()==False') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1348 ee('assert sys.stderr.seekable()==False') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1349 ee('sys.stderr.close()') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1350 ee('sys.stderr.flush()') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1351 ee('sys.stdout.attr = None') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1352 cb.append(">> OutputWrite") |
7191
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1353 ee('assert sys.stdout.writable()==True') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1354 ee('assert sys.stdout.readable()==False') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1355 ee('assert sys.stderr.writable()==True') |
692dac7183de
commit https://github.com/vim/vim/commit/d424747d5821c2873e24d25d3407d08b25ea3443
Christian Brabandt <cb@256bit.org>
parents:
6257
diff
changeset
|
1356 ee('assert sys.stderr.readable()==False') |
8967
df5f9284fcba
commit https://github.com/vim/vim/commit/6d4431e7b675ba7a0194c0b8eb84b7d92e4e7953
Christian Brabandt <cb@256bit.org>
parents:
8889
diff
changeset
|
1357 ee('assert sys.stdout.closed()==False') |
df5f9284fcba
commit https://github.com/vim/vim/commit/6d4431e7b675ba7a0194c0b8eb84b7d92e4e7953
Christian Brabandt <cb@256bit.org>
parents:
8889
diff
changeset
|
1358 ee('assert sys.stderr.closed()==False') |
df5f9284fcba
commit https://github.com/vim/vim/commit/6d4431e7b675ba7a0194c0b8eb84b7d92e4e7953
Christian Brabandt <cb@256bit.org>
parents:
8889
diff
changeset
|
1359 ee('assert sys.stdout.errors=="strict"') |
df5f9284fcba
commit https://github.com/vim/vim/commit/6d4431e7b675ba7a0194c0b8eb84b7d92e4e7953
Christian Brabandt <cb@256bit.org>
parents:
8889
diff
changeset
|
1360 ee('assert sys.stderr.errors=="strict"') |
df5f9284fcba
commit https://github.com/vim/vim/commit/6d4431e7b675ba7a0194c0b8eb84b7d92e4e7953
Christian Brabandt <cb@256bit.org>
parents:
8889
diff
changeset
|
1361 ee('assert sys.stdout.encoding==sys.stderr.encoding') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1362 ee('sys.stdout.write(None)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1363 cb.append(">> OutputWriteLines") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1364 ee('sys.stdout.writelines(None)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1365 ee('sys.stdout.writelines([1])') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1366 iter_test('sys.stdout.writelines(%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1367 cb.append("> VimCommand") |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1368 stringtochars_test('vim.command(%s)') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1369 ee('vim.command("", 2)') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1370 #! Not checked: vim->python exceptions translating: checked later |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1371 cb.append("> VimToPython") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1372 #! Not checked: everything: needs errors in internal python functions |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1373 cb.append("> VimEval") |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1374 stringtochars_test('vim.eval(%s)') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1375 ee('vim.eval("", FailingTrue())') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1376 #! Not checked: everything: needs errors in internal python functions |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1377 cb.append("> VimEvalPy") |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1378 stringtochars_test('vim.bindeval(%s)') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1379 ee('vim.eval("", 2)') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1380 #! Not checked: vim->python exceptions translating: checked later |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1381 cb.append("> VimStrwidth") |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1382 stringtochars_test('vim.strwidth(%s)') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1383 cb.append("> VimForeachRTP") |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1384 ee('vim.foreach_rtp(None)') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1385 ee('vim.foreach_rtp(NoArgsCall())') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1386 ee('vim.foreach_rtp(FailingCall())') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1387 ee('vim.foreach_rtp(int, 2)') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1388 cb.append('> import') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1389 old_rtp = vim.options['rtp'] |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1390 vim.options['rtp'] = os.getcwd().replace('\\', '\\\\').replace(',', '\\,') |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1391 ee('import xxx_no_such_module_xxx') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1392 ee('import failing_import') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1393 ee('import failing') |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1394 vim.options['rtp'] = old_rtp |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1395 del old_rtp |
5610 | 1396 cb.append("> Options") |
1397 cb.append(">> OptionsItem") | |
1398 ee('vim.options["abcQ"]') | |
1399 ee('vim.options[""]') | |
1400 stringtochars_test('vim.options[%s]') | |
1401 cb.append(">> OptionsContains") | |
1402 stringtochars_test('%s in vim.options') | |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1403 cb.append("> Dictionary") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1404 cb.append(">> DictionaryConstructor") |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1405 ee('vim.Dictionary("abcI")') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1406 ##! Not checked: py_dict_alloc failure |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1407 cb.append(">> DictionarySetattr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1408 ee('del d.locked') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1409 ee('d.locked = FailingTrue()') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1410 ee('vim.vvars.locked = False') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1411 ee('d.scope = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1412 ee('d.xxx = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1413 cb.append(">> _DictionaryItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1414 ee('d.get("a", 2, 3)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1415 stringtochars_test('d.get(%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1416 ee('d.pop("a")') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1417 ee('dl.pop("a")') |
5426 | 1418 cb.append(">> DictionaryContains") |
1419 ee('"" in d') | |
1420 ee('0 in d') | |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1421 cb.append(">> DictionaryIterNext") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1422 ee('for i in ned: ned["a"] = 1') |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1423 del i |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1424 cb.append(">> DictionaryAssItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1425 ee('dl["b"] = 1') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1426 stringtochars_test('d[%s] = 1') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1427 convertfrompyobject_test('d["a"] = %s') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1428 cb.append(">> DictionaryUpdate") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1429 cb.append(">>> kwargs") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1430 cb.append(">>> iter") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1431 ee('d.update(FailingMapping())') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1432 ee('d.update([FailingIterNext()])') |
5608 | 1433 ee('d.update([FailingIterNextN(1)])') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1434 iter_test('d.update(%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1435 convertfrompyobject_test('d.update(%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1436 stringtochars_test('d.update(((%s, 0),))') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1437 convertfrompyobject_test('d.update((("a", %s),))') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1438 cb.append(">> DictionaryPopItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1439 ee('d.popitem(1, 2)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1440 cb.append(">> DictionaryHasKey") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1441 ee('d.has_key()') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1442 cb.append("> List") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1443 cb.append(">> ListConstructor") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1444 ee('vim.List(1, 2)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1445 ee('vim.List(a=1)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1446 iter_test('vim.List(%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1447 convertfrompyobject_test('vim.List([%s])') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1448 cb.append(">> ListItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1449 ee('l[1000]') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1450 cb.append(">> ListAssItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1451 ee('ll[1] = 2') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1452 ee('l[1000] = 3') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1453 cb.append(">> ListAssSlice") |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1454 ee('ll[1:100] = "abcJ"') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1455 iter_test('l[:] = %s') |
5608 | 1456 ee('nel[1:10:2] = "abcK"') |
1457 cb.append(repr(tuple(nel))) | |
1458 ee('nel[1:10:2] = "a"') | |
1459 cb.append(repr(tuple(nel))) | |
1460 ee('nel[1:1:-1] = "a"') | |
1461 cb.append(repr(tuple(nel))) | |
1462 ee('nel[:] = FailingIterNextN(2)') | |
1463 cb.append(repr(tuple(nel))) | |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1464 convertfrompyobject_test('l[:] = [%s]') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1465 cb.append(">> ListConcatInPlace") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1466 iter_test('l.extend(%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1467 convertfrompyobject_test('l.extend([%s])') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1468 cb.append(">> ListSetattr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1469 ee('del l.locked') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1470 ee('l.locked = FailingTrue()') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1471 ee('l.xxx = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1472 cb.append("> Function") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1473 cb.append(">> FunctionConstructor") |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1474 cb.append(">>> FunctionConstructor") |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1475 ee('vim.Function("123")') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1476 ee('vim.Function("xxx_non_existent_function_xxx")') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1477 ee('vim.Function("xxx#non#existent#function#xxx")') |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1478 ee('vim.Function("xxx_non_existent_function_xxx2", args=[])') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1479 ee('vim.Function("xxx_non_existent_function_xxx3", self={})') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1480 ee('vim.Function("xxx_non_existent_function_xxx4", args=[], self={})') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1481 cb.append(">>> FunctionNew") |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1482 ee('vim.Function("tr", self="abcFuncSelf")') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1483 ee('vim.Function("tr", args=427423)') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1484 ee('vim.Function("tr", self="abcFuncSelf2", args="abcFuncArgs2")') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1485 ee('vim.Function(self="abcFuncSelf2", args="abcFuncArgs2")') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1486 ee('vim.Function("tr", "", self="abcFuncSelf2", args="abcFuncArgs2")') |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1487 ee('vim.Function("tr", "")') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1488 cb.append(">> FunctionCall") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1489 convertfrompyobject_test('f(%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1490 convertfrompymapping_test('fd(self=%s)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1491 cb.append("> TabPage") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1492 cb.append(">> TabPageAttr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1493 ee('vim.current.tabpage.xxx') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1494 cb.append("> TabList") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1495 cb.append(">> TabListItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1496 ee('vim.tabpages[1000]') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1497 cb.append("> Window") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1498 cb.append(">> WindowAttr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1499 ee('vim.current.window.xxx') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1500 cb.append(">> WindowSetattr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1501 ee('vim.current.window.buffer = 0') |
4663
bce2051173f0
updated for version 7.3.1079
Bram Moolenaar <bram@vim.org>
parents:
4645
diff
changeset
|
1502 ee('vim.current.window.cursor = (100000000, 100000000)') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1503 ee('vim.current.window.cursor = True') |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1504 number_test('vim.current.window.height = %s', unsigned=True) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1505 number_test('vim.current.window.width = %s', unsigned=True) |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1506 ee('vim.current.window.xxxxxx = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1507 cb.append("> WinList") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1508 cb.append(">> WinListItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1509 ee('vim.windows[1000]') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1510 cb.append("> Buffer") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1511 cb.append(">> StringToLine (indirect)") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1512 ee('vim.current.buffer[0] = "\\na"') |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1513 ee('vim.current.buffer[0] = b"\\na"') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1514 cb.append(">> SetBufferLine (indirect)") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1515 ee('vim.current.buffer[0] = True') |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1516 cb.append(">> SetBufferLineList (indirect)") |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1517 ee('vim.current.buffer[:] = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1518 ee('vim.current.buffer[:] = ["\\na", "bc"]') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1519 cb.append(">> InsertBufferLines (indirect)") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1520 ee('vim.current.buffer.append(None)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1521 ee('vim.current.buffer.append(["\\na", "bc"])') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1522 ee('vim.current.buffer.append("\\nbc")') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1523 cb.append(">> RBItem") |
4663
bce2051173f0
updated for version 7.3.1079
Bram Moolenaar <bram@vim.org>
parents:
4645
diff
changeset
|
1524 ee('vim.current.buffer[100000000]') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1525 cb.append(">> RBAsItem") |
4663
bce2051173f0
updated for version 7.3.1079
Bram Moolenaar <bram@vim.org>
parents:
4645
diff
changeset
|
1526 ee('vim.current.buffer[100000000] = ""') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1527 cb.append(">> BufferAttr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1528 ee('vim.current.buffer.xxx') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1529 cb.append(">> BufferSetattr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1530 ee('vim.current.buffer.name = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1531 ee('vim.current.buffer.xxx = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1532 cb.append(">> BufferMark") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1533 ee('vim.current.buffer.mark(0)') |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1534 ee('vim.current.buffer.mark("abcM")') |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1535 ee('vim.current.buffer.mark("!")') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1536 cb.append(">> BufferRange") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1537 ee('vim.current.buffer.range(1, 2, 3)') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1538 cb.append("> BufMap") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1539 cb.append(">> BufMapItem") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1540 ee('vim.buffers[100000000]') |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1541 number_test('vim.buffers[%s]', natural=True) |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1542 cb.append("> Current") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1543 cb.append(">> CurrentGetattr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1544 ee('vim.current.xxx') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1545 cb.append(">> CurrentSetattr") |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1546 ee('vim.current.line = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1547 ee('vim.current.buffer = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1548 ee('vim.current.window = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1549 ee('vim.current.tabpage = True') |
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1550 ee('vim.current.xxx = True') |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1551 del d |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1552 del ned |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1553 del dl |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1554 del l |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1555 del ll |
5608 | 1556 del nel |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1557 del f |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1558 del fd |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1559 del fdel |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1560 del subexpr_test |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1561 del stringtochars_test |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1562 del Mapping |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1563 del convertfrompyobject_test |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1564 del convertfrompymapping_test |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1565 del iter_test |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1566 del number_test |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1567 del FailingTrue |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1568 del FailingIter |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1569 del FailingIterNext |
5608 | 1570 del FailingIterNextN |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1571 del FailingMapping |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1572 del FailingMappingKey |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1573 del FailingList |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1574 del NoArgsCall |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1575 del FailingCall |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1576 del FailingNumber |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1577 EOF |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1578 :delfunction F |
4637
4c46e1487c63
updated for version 7.3.1066
Bram Moolenaar <bram@vim.org>
parents:
4631
diff
changeset
|
1579 :" |
4839
d59ff2114733
updated for version 7.3.1166
Bram Moolenaar <bram@vim.org>
parents:
4833
diff
changeset
|
1580 :" Test import |
d59ff2114733
updated for version 7.3.1166
Bram Moolenaar <bram@vim.org>
parents:
4833
diff
changeset
|
1581 py3 << EOF |
4851
96e154e825a7
updated for version 7.3.1172
Bram Moolenaar <bram@vim.org>
parents:
4839
diff
changeset
|
1582 sys.path.insert(0, os.path.join(os.getcwd(), 'python_before')) |
96e154e825a7
updated for version 7.3.1172
Bram Moolenaar <bram@vim.org>
parents:
4839
diff
changeset
|
1583 sys.path.append(os.path.join(os.getcwd(), 'python_after')) |
4839
d59ff2114733
updated for version 7.3.1166
Bram Moolenaar <bram@vim.org>
parents:
4833
diff
changeset
|
1584 vim.options['rtp'] = os.getcwd().replace(',', '\\,').replace('\\', '\\\\') |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1585 l = [] |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1586 def callback(path): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1587 l.append(os.path.relpath(path)) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1588 vim.foreach_rtp(callback) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1589 cb.append(repr(l)) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1590 del l |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1591 def callback(path): |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1592 return os.path.relpath(path) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1593 cb.append(repr(vim.foreach_rtp(callback))) |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1594 del callback |
4839
d59ff2114733
updated for version 7.3.1166
Bram Moolenaar <bram@vim.org>
parents:
4833
diff
changeset
|
1595 from module import dir as d |
d59ff2114733
updated for version 7.3.1166
Bram Moolenaar <bram@vim.org>
parents:
4833
diff
changeset
|
1596 from modulex import ddir |
d59ff2114733
updated for version 7.3.1166
Bram Moolenaar <bram@vim.org>
parents:
4833
diff
changeset
|
1597 cb.append(d + ',' + ddir) |
4851
96e154e825a7
updated for version 7.3.1172
Bram Moolenaar <bram@vim.org>
parents:
4839
diff
changeset
|
1598 import before |
96e154e825a7
updated for version 7.3.1172
Bram Moolenaar <bram@vim.org>
parents:
4839
diff
changeset
|
1599 cb.append(before.dir) |
96e154e825a7
updated for version 7.3.1172
Bram Moolenaar <bram@vim.org>
parents:
4839
diff
changeset
|
1600 import after |
96e154e825a7
updated for version 7.3.1172
Bram Moolenaar <bram@vim.org>
parents:
4839
diff
changeset
|
1601 cb.append(after.dir) |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1602 import topmodule as tm |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1603 import topmodule.submodule as tms |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1604 import topmodule.submodule.subsubmodule.subsubsubmodule as tmsss |
5012
6aecf486bb34
updated for version 7.3.1250
Bram Moolenaar <bram@vim.org>
parents:
4982
diff
changeset
|
1605 cb.append(tm.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/__init__.py'):]) |
6aecf486bb34
updated for version 7.3.1250
Bram Moolenaar <bram@vim.org>
parents:
4982
diff
changeset
|
1606 cb.append(tms.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/__init__.py'):]) |
6aecf486bb34
updated for version 7.3.1250
Bram Moolenaar <bram@vim.org>
parents:
4982
diff
changeset
|
1607 cb.append(tmsss.__file__.replace(os.path.sep, '/')[-len('modulex/topmodule/submodule/subsubmodule/subsubsubmodule.py'):]) |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1608 del before |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1609 del after |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1610 del d |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1611 del ddir |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1612 del tm |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1613 del tms |
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1614 del tmsss |
4839
d59ff2114733
updated for version 7.3.1166
Bram Moolenaar <bram@vim.org>
parents:
4833
diff
changeset
|
1615 EOF |
4833
70b1178dec79
updated for version 7.3.1163
Bram Moolenaar <bram@vim.org>
parents:
4706
diff
changeset
|
1616 :" |
4498 | 1617 :" Test exceptions |
1618 :fun Exe(e) | |
1619 : execute a:e | |
1620 :endfun | |
1621 py3 << EOF | |
1622 Exe = vim.bindeval('function("Exe")') | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1623 ee('vim.command("throw \'abcN\'")') |
4498 | 1624 ee('Exe("throw \'def\'")') |
1625 ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")') | |
1626 ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")') | |
1627 ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")') | |
5517 | 1628 ee('vim.eval("xxx_unknown_function_xxx()")') |
4498 | 1629 ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")') |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1630 del Exe |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1631 EOF |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1632 :delfunction Exe |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1633 :" |
5469 | 1634 :" Regression: interrupting vim.command propagates to next vim.command |
1635 py3 << EOF | |
1636 def test_keyboard_interrupt(): | |
1637 try: | |
1638 vim.command('while 1 | endwhile') | |
1639 except KeyboardInterrupt: | |
1640 cb.append('Caught KeyboardInterrupt') | |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1641 except Exception: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1642 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) |
5469 | 1643 else: |
1644 cb.append('!!!!!!!! No exception') | |
1645 try: | |
1646 vim.command('$ put =\'Running :put\'') | |
1647 except KeyboardInterrupt: | |
1648 cb.append('!!!!!!!! Caught KeyboardInterrupt') | |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1649 except Exception: |
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1650 cb.append('!!!!!!!! Caught exception: ' + emsg(sys.exc_info())) |
5469 | 1651 else: |
1652 cb.append('No exception') | |
1653 EOF | |
1654 :debuggreedy | |
1655 :call inputsave() | |
1656 :call feedkeys("s\ns\ns\ns\nq\n") | |
1657 :redir => output | |
1658 :debug silent! py3 test_keyboard_interrupt() | |
1659 :redir END | |
1660 :0 debuggreedy | |
6257 | 1661 :call inputrestore() |
5469 | 1662 :silent $put =output |
1663 :unlet output | |
1664 :py3 del test_keyboard_interrupt | |
1665 :" | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1666 :" Cleanup |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1667 py3 << EOF |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1668 del cb |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1669 del ee |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1670 del emsg |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1671 del sys |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1672 del os |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1673 del vim |
4498 | 1674 EOF |
3618 | 1675 :endfun |
1676 :" | |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1677 :fun RunTest() |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1678 :let checkrefs = !empty($PYTHONDUMPREFS) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1679 :let start = getline(1, '$') |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1680 :for i in range(checkrefs ? 10 : 1) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1681 : if i != 0 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1682 : %d _ |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1683 : call setline(1, start) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1684 : endif |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1685 : call Test() |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1686 : if i == 0 |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1687 : let result = getline(1, '$') |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1688 : endif |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1689 :endfor |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1690 :if checkrefs |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1691 : %d _ |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1692 : call setline(1, result) |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1693 :endif |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1694 :endfun |
3618 | 1695 :" |
4976
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1696 :call RunTest() |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1697 :delfunction RunTest |
4ed713442c51
updated for version 7.3.1233
Bram Moolenaar <bram@vim.org>
parents:
4851
diff
changeset
|
1698 :delfunction Test |
3618 | 1699 :call garbagecollect(1) |
1700 :" | |
1701 :/^start:/,$wq! test.out | |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1702 :/^start:/,$w! test.out |
4982
39980afcf54a
updated for version 7.3.1236
Bram Moolenaar <bram@vim.org>
parents:
4976
diff
changeset
|
1703 :" vim: et ts=4 isk-=\: |
8889
8755d57debaa
commit https://github.com/vim/vim/commit/8110a091bc749d8748a20807a724a3af3ca6d509
Christian Brabandt <cb@256bit.org>
parents:
8328
diff
changeset
|
1704 :while getchar(0) isnot 0|endwhile |
3618 | 1705 ENDTEST |
1706 | |
1707 start: |