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