annotate src/testdir/test87.in @ 13921:3b6c29f8c1a2 v8.0.1831

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