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