annotate src/testdir/test55.in @ 10609:302aedeed8c9 v8.0.0194

patch 8.0.0194: profile tests fails if total and self time are equal commit https://github.com/vim/vim/commit/e32bbded641a5da0263ecf82f9ccc95a8e0a089e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 15 21:12:48 2017 +0100 patch 8.0.0194: profile tests fails if total and self time are equal Problem: Profile tests fails if total and self time are equal. Solution: Make one time optional.
author Christian Brabandt <cb@256bit.org>
date Sun, 15 Jan 2017 21:15:04 +0100
parents e5f2e0f8af10
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
1 Tests for List and Dictionary types. vim: set ft=vim :
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
2
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
3 STARTTEST
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
4 :so small.vim
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
5 :fun Test(...)
4191
4dd43d6b3df7 updated for version 7.3.847
Bram Moolenaar <bram@vim.org>
parents: 3774
diff changeset
6 :lang C
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
7 :" Creating List directly with different types
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
8 :let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
9 :$put =string(l)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
10 :$put =string(l[-1])
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
11 :$put =string(l[-4])
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
12 :try
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
13 : $put =string(l[-5])
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
14 :catch
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
15 : $put =v:exception[:14]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
16 :endtry
842
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
17 :" List slices
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
18 :$put =string(l[:])
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
19 :$put =string(l[1:])
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
20 :$put =string(l[:-2])
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
21 :$put =string(l[0:8])
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
22 :$put =string(l[8:-1])
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
23 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
24 :" List identity
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
25 :let ll = l
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
26 :let lx = copy(l)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
27 :try
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
28 : $put =(l == ll) . (l isnot ll) . (l is ll) . (l == lx) . (l is lx) . (l isnot lx)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
29 :catch
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
30 : $put =v:exception
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
31 :endtry
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
32 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
33 :" Creating Dictionary directly with different types
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
34 :let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},}
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
35 :$put =string(d) . d.1
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
36 :$put =string(sort(keys(d)))
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
37 :$put =string (values(d))
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
38 :for [key, val] in items(d)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
39 : $put =key . ':' . string(val)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
40 : unlet key val
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
41 :endfor
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
42 :call extend (d, {3:33, 1:99})
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
43 :call extend(d, {'b':'bbb', 'c':'ccc'}, "keep")
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
44 :try
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
45 : call extend(d, {3:333,4:444}, "error")
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
46 :catch
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
47 : $put =v:exception[:15] . v:exception[-1:-1]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
48 :endtry
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
49 :$put =string(d)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
50 :call filter(d, 'v:key =~ ''[ac391]''')
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
51 :$put =string(d)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
52 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
53 :" Dictionary identity
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
54 :let dd = d
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
55 :let dx = copy(d)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
56 :try
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
57 : $put =(d == dd) . (d isnot dd) . (d is dd) . (d == dx) . (d is dx) . (d isnot dx)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
58 :catch
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
59 : $put =v:exception
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
60 :endtry
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
61 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
62 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
63 :" removing items with :unlet
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
64 :unlet l[2]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
65 :$put =string(l)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
66 :let l = range(8)
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
67 :try
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
68 :unlet l[:3]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
69 :unlet l[1:]
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
70 :catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
71 :$put =v:exception
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
72 :endtry
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
73 :$put =string(l)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
74 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
75 :unlet d.c
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
76 :unlet d[-1]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
77 :$put =string(d)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
78 :"
842
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
79 :" removing items out of range: silently skip items that don't exist
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
80 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
81 :unlet l[2:1]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
82 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
83 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
84 :unlet l[2:2]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
85 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
86 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
87 :unlet l[2:3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
88 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
89 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
90 :unlet l[2:4]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
91 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
92 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
93 :unlet l[2:5]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
94 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
95 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
96 :unlet l[-1:2]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
97 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
98 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
99 :unlet l[-2:2]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
100 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
101 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
102 :unlet l[-3:2]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
103 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
104 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
105 :unlet l[-4:2]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
106 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
107 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
108 :unlet l[-5:2]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
109 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
110 let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
111 :unlet l[-6:2]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
112 :$put =string(l)
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
113 :"
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
114 :" assignment to a list
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
115 :let l = [0, 1, 2, 3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
116 :let [va, vb] = l[2:3]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
117 :$put =va
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
118 :$put =vb
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
119 :try
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
120 : let [va, vb] = l
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
121 :catch
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
122 : $put =v:exception[:14]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
123 :endtry
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
124 :try
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
125 : let [va, vb] = l[1:1]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
126 :catch
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
127 : $put =v:exception[:14]
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
128 :endtry
a209672376fd updated for version 7.0f
vimboss
parents: 294
diff changeset
129 :"
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
130 :" manipulating a big Dictionary (hashtable.c has a border of 1000 entries)
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
131 :let d = {}
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
132 :for i in range(1500)
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
133 : let d[i] = 3000 - i
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
134 :endfor
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
135 :$put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' . d[1499]
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
136 :try
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
137 : let n = d[1500]
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
138 :catch
1539
b62965091b8d updated for version 7.1-254
vimboss
parents: 1405
diff changeset
139 : $put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '')
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
140 :endtry
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
141 :" lookup each items
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
142 :for i in range(1500)
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
143 : if d[i] != 3000 - i
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
144 : $put =d[i]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
145 : endif
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
146 :endfor
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
147 : let i += 1
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
148 :" delete even items
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
149 :while i >= 2
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
150 : let i -= 2
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
151 : unlet d[i]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
152 :endwhile
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
153 :$put =get(d, 1500 - 100, 'NONE') . ' ' . d[1]
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
154 :" delete odd items, checking value, one intentionally wrong
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
155 :let d[33] = 999
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
156 :let i = 1
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
157 :while i < 1500
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
158 : if d[i] != 3000 - i
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
159 : $put =i . '=' . d[i]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
160 : else
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
161 : unlet d[i]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
162 : endif
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
163 : let i += 2
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
164 :endwhile
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
165 :$put =string(d) " must be almost empty now
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
166 :unlet d
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
167 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
168 :" Dictionary function
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
169 :let dict = {}
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
170 :func dict.func(a) dict
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
171 : $put =a:a . len(self.data)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
172 :endfunc
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
173 :let dict.data = [1,2,3]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
174 :call dict.func("len: ")
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
175 :let x = dict.func("again: ")
8631
e5f2e0f8af10 commit https://github.com/vim/vim/commit/3905e291fe4375ca5c59efa9ffcb01a39c7be3a9
Christian Brabandt <cb@256bit.org>
parents: 8516
diff changeset
176 :let Fn = dict.func
e5f2e0f8af10 commit https://github.com/vim/vim/commit/3905e291fe4375ca5c59efa9ffcb01a39c7be3a9
Christian Brabandt <cb@256bit.org>
parents: 8516
diff changeset
177 :call Fn('xxx')
123
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
178 :"
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
179 :" Function in script-local List or Dict
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
180 :let g:dict = {}
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
181 :function g:dict.func() dict
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
182 : $put ='g:dict.func'.self.foo[1].self.foo[0]('asdf')
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
183 :endfunc
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
184 :let g:dict.foo = ['-', 2, 3]
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
185 :call insert(g:dict.foo, function('strlen'))
f67f8a8d81ba updated for version 7.0043
vimboss
parents: 119
diff changeset
186 :call g:dict.func()
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
187 :"
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
188 :" Nasty: remove func from Dict that's being called (works)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
189 :let d = {1:1}
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
190 :func d.func(a)
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
191 : return "a:". a:a
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
192 :endfunc
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
193 :$put =d.func(string(remove(d, 'func')))
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
194 :"
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
195 :" Nasty: deepcopy() dict that refers to itself (fails when noref used)
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
196 :let d = {1:1, 2:2}
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
197 :let l = [4, d, 6]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
198 :let d[3] = l
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
199 :let dc = deepcopy(d)
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
200 :try
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
201 : let dc = deepcopy(d, 1)
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
202 :catch
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
203 : $put =v:exception[:14]
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
204 :endtry
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
205 :let l2 = [0, l, l, 3]
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
206 :let l[1] = l2
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
207 :let l3 = deepcopy(l2)
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
208 :$put ='same list: ' . (l3[1] is l3[2])
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
209 :"
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
210 :" Locked variables
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
211 :for depth in range(5)
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
212 : $put ='depth is ' . depth
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
213 : for u in range(3)
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
214 : unlet l
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
215 : let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
216 : exe "lockvar " . depth . " l"
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
217 : if u == 1
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
218 : exe "unlockvar l"
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
219 : elseif u == 2
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
220 : exe "unlockvar " . depth . " l"
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
221 : endif
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
222 : let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]")
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
223 : $put =ps
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
224 : let ps = ''
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
225 : try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
226 : let l[1][1][0] = 99
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
227 : let ps .= 'p'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
228 : catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
229 : let ps .= 'F'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
230 : endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
231 : try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
232 : let l[1][1] = [99]
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
233 : let ps .= 'p'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
234 : catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
235 : let ps .= 'F'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
236 : endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
237 : try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
238 : let l[1] = [99]
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
239 : let ps .= 'p'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
240 : catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
241 : let ps .= 'F'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
242 : endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
243 : try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
244 : let l[2]['6'][7] = 99
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
245 : let ps .= 'p'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
246 : catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
247 : let ps .= 'F'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
248 : endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
249 : try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
250 : let l[2][6] = {99: 99}
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
251 : let ps .= 'p'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
252 : catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
253 : let ps .= 'F'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
254 : endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
255 : try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
256 : let l[2] = {99: 99}
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
257 : let ps .= 'p'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
258 : catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
259 : let ps .= 'F'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
260 : endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
261 : try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
262 : let l = [99]
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
263 : let ps .= 'p'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
264 : catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
265 : let ps .= 'F'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
266 : endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
267 : $put =ps
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
268 : endfor
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
269 :endfor
6751
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
270 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
271 :" Unletting locked variables
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
272 :$put ='Unletting:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
273 :for depth in range(5)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
274 : $put ='depth is ' . depth
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
275 : for u in range(3)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
276 : unlet l
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
277 : let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
278 : exe "lockvar " . depth . " l"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
279 : if u == 1
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
280 : exe "unlockvar l"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
281 : elseif u == 2
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
282 : exe "unlockvar " . depth . " l"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
283 : endif
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
284 : let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]")
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
285 : $put =ps
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
286 : let ps = ''
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
287 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
288 : unlet l[2]['6'][7]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
289 : let ps .= 'p'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
290 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
291 : let ps .= 'F'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
292 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
293 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
294 : unlet l[2][6]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
295 : let ps .= 'p'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
296 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
297 : let ps .= 'F'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
298 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
299 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
300 : unlet l[2]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
301 : let ps .= 'p'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
302 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
303 : let ps .= 'F'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
304 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
305 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
306 : unlet l[1][1][0]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
307 : let ps .= 'p'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
308 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
309 : let ps .= 'F'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
310 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
311 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
312 : unlet l[1][1]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
313 : let ps .= 'p'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
314 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
315 : let ps .= 'F'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
316 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
317 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
318 : unlet l[1]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
319 : let ps .= 'p'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
320 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
321 : let ps .= 'F'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
322 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
323 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
324 : unlet l
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
325 : let ps .= 'p'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
326 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
327 : let ps .= 'F'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
328 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
329 : $put =ps
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
330 : endfor
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
331 :endfor
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
332 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
333 :" Locked variables and :unlet or list / dict functions
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
334 :$put ='Locks and commands or functions:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
335 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
336 :$put ='No :unlet after lock on dict:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
337 :unlet! d
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
338 :let d = {'a': 99, 'b': 100}
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
339 :lockvar 1 d
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
340 :try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
341 : unlet d.a
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
342 : $put ='did :unlet'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
343 :catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
344 : $put =v:exception[:16]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
345 :endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
346 :$put =string(d)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
347 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
348 :$put =':unlet after lock on dict item:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
349 :unlet! d
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
350 :let d = {'a': 99, 'b': 100}
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
351 :lockvar d.a
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
352 :try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
353 : unlet d.a
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
354 : $put ='did :unlet'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
355 :catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
356 : $put =v:exception[:16]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
357 :endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
358 :$put =string(d)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
359 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
360 :$put ='filter() after lock on dict item:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
361 :unlet! d
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
362 :let d = {'a': 99, 'b': 100}
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
363 :lockvar d.a
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
364 :try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
365 : call filter(d, 'v:key != "a"')
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
366 : $put ='did filter()'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
367 :catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
368 : $put =v:exception[:16]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
369 :endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
370 :$put =string(d)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
371 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
372 :$put ='map() after lock on dict:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
373 :unlet! d
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
374 :let d = {'a': 99, 'b': 100}
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
375 :lockvar 1 d
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
376 :try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
377 : call map(d, 'v:val + 200')
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
378 : $put ='did map()'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
379 :catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
380 : $put =v:exception[:16]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
381 :endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
382 :$put =string(d)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
383 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
384 :$put ='No extend() after lock on dict item:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
385 :unlet! d
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
386 :let d = {'a': 99, 'b': 100}
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
387 :lockvar d.a
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
388 :try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
389 : $put =string(extend(d, {'a': 123}))
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
390 : $put ='did extend()'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
391 :catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
392 : $put =v:exception[:14]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
393 :endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
394 :$put =string(d)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
395 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
396 :$put ='No remove() of write-protected scope-level variable:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
397 :fun! Tfunc(this_is_a_loooooooooong_parameter_name)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
398 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
399 : $put =string(remove(a:, 'this_is_a_loooooooooong_parameter_name'))
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
400 : $put ='did remove()'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
401 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
402 : $put =v:exception[:14]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
403 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
404 :endfun
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
405 :call Tfunc('testval')
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
406 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
407 :$put ='No extend() of write-protected scope-level variable:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
408 :fun! Tfunc(this_is_a_loooooooooong_parameter_name)
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
409 : try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
410 : $put =string(extend(a:, {'this_is_a_loooooooooong_parameter_name': 1234}))
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
411 : $put ='did extend()'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
412 : catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
413 : $put =v:exception[:14]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
414 : endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
415 :endfun
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
416 :call Tfunc('testval')
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
417 :"
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
418 :$put ='No :unlet of variable in locked scope:'
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
419 :let b:testvar = 123
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
420 :lockvar 1 b:
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
421 :try
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
422 : unlet b:testvar
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
423 : $put ='b:testvar was :unlet: '. (!exists('b:testvar'))
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
424 :catch
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
425 : $put =v:exception[:16]
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
426 :endtry
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
427 :unlockvar 1 b:
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
428 :unlet! b:testvar
f5b262981753 patch 7.4.698
Bram Moolenaar <bram@vim.org>
parents: 6422
diff changeset
429 :"
6791
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
430 :$put ='No :let += of locked list variable:'
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
431 :let l = ['a', 'b', 3]
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
432 :lockvar 1 l
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
433 :try
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
434 : let l += ['x']
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
435 : $put ='did :let +='
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
436 :catch
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
437 : $put =v:exception[:14]
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
438 :endtry
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
439 :$put =string(l)
1805e45ce4d6 patch 7.4.717
Bram Moolenaar <bram@vim.org>
parents: 6751
diff changeset
440 :"
6166
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
441 :unlet l
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
442 :let l = [1, 2, 3, 4]
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
443 :lockvar! l
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
444 :$put =string(l)
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
445 :unlockvar l[1]
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
446 :unlet l[0:1]
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
447 :$put =string(l)
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
448 :unlet l[1:2]
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
449 :$put =string(l)
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
450 :unlockvar l[1]
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
451 :let l[0:1] = [0, 1]
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
452 :$put =string(l)
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
453 :let l[1:2] = [0, 1]
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
454 :$put =string(l)
0a42938f449c updated for version 7.4.419
Bram Moolenaar <bram@vim.org>
parents: 6022
diff changeset
455 :unlet l
5604
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 4191
diff changeset
456 :" :lockvar/islocked() triggering script autoloading
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 4191
diff changeset
457 :set rtp+=./sautest
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 4191
diff changeset
458 :lockvar g:footest#x
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 4191
diff changeset
459 :unlockvar g:footest#x
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 4191
diff changeset
460 :$put ='locked g:footest#x:'.islocked('g:footest#x')
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 4191
diff changeset
461 :$put ='exists g:footest#x:'.exists('g:footest#x')
b43363a7b4c7 updated for version 7.4.149
Bram Moolenaar <bram@vim.org>
parents: 4191
diff changeset
462 :$put ='g:footest#x: '.g:footest#x
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
463 :"
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
464 :" a:000 function argument
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
465 :" first the tests that should fail
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
466 :try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
467 : let a:000 = [1, 2]
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
468 :catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
469 : $put ='caught a:000'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
470 :endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
471 :try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
472 : let a:000[0] = 9
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
473 :catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
474 : $put ='caught a:000[0]'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
475 :endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
476 :try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
477 : let a:000[2] = [9, 10]
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
478 :catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
479 : $put ='caught a:000[2]'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
480 :endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
481 :try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
482 : let a:000[3] = {9: 10}
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
483 :catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
484 : $put ='caught a:000[3]'
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
485 :endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
486 :" now the tests that should pass
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
487 :try
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
488 : let a:000[2][1] = 9
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
489 : call extend(a:000[2], [5, 6])
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
490 : let a:000[3][5] = 8
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
491 : let a:000[3]['a'] = 12
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
492 : $put =string(a:000)
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
493 :catch
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
494 : $put ='caught ' . v:exception
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
495 :endtry
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
496 :"
5747
ddc3f32a4b21 updated for version 7.4.218
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
497 :" reverse(), sort(), uniq()
ddc3f32a4b21 updated for version 7.4.218
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
498 :let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
ddc3f32a4b21 updated for version 7.4.218
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
499 :$put =string(uniq(copy(l)))
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
500 :$put =string(reverse(l))
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
501 :$put =string(reverse(reverse(l)))
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
502 :$put =string(sort(l))
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
503 :$put =string(reverse(sort(l)))
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
504 :$put =string(sort(reverse(sort(l))))
5747
ddc3f32a4b21 updated for version 7.4.218
Bram Moolenaar <bram@vim.org>
parents: 5604
diff changeset
505 :$put =string(uniq(sort(l)))
6022
f9ec944e4474 updated for version 7.4.351
Bram Moolenaar <bram@vim.org>
parents: 6014
diff changeset
506 :let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four']
6014
a162d41f10e1 updated for version 7.4.347
Bram Moolenaar <bram@vim.org>
parents: 6001
diff changeset
507 :$put =string(sort(copy(l), 'n'))
6022
f9ec944e4474 updated for version 7.4.351
Bram Moolenaar <bram@vim.org>
parents: 6014
diff changeset
508 :let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
6001
adc4a84f72eb updated for version 7.4.341
Bram Moolenaar <bram@vim.org>
parents: 5747
diff changeset
509 :$put =string(sort(copy(l), 1))
adc4a84f72eb updated for version 7.4.341
Bram Moolenaar <bram@vim.org>
parents: 5747
diff changeset
510 :$put =string(sort(copy(l), 'i'))
adc4a84f72eb updated for version 7.4.341
Bram Moolenaar <bram@vim.org>
parents: 5747
diff changeset
511 :$put =string(sort(copy(l)))
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 148
diff changeset
512 :"
283
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
513 :" splitting a string to a List
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
514 :$put =string(split(' aa bb '))
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
515 :$put =string(split(' aa bb ', '\W\+', 0))
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
516 :$put =string(split(' aa bb ', '\W\+', 1))
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
517 :$put =string(split(' aa bb ', '\W', 1))
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
518 :$put =string(split(':aa::bb:', ':', 0))
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
519 :$put =string(split(':aa::bb:', ':', 1))
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
520 :$put =string(split('aa,,bb, cc,', ',\s*', 1))
294
1c1cbdc42f75 updated for version 7.0077
vimboss
parents: 283
diff changeset
521 :$put =string(split('abc', '\zs'))
1c1cbdc42f75 updated for version 7.0077
vimboss
parents: 283
diff changeset
522 :$put =string(split('abc', '\zs', 1))
283
a2ff714de3db updated for version 7.0075
vimboss
parents: 164
diff changeset
523 :"
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
524 :" compare recursively linked list and dict
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
525 :let l = [1, 2, 3, 4]
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
526 :let d = {'1': 1, '2': l, '3': 3}
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
527 :let l[1] = d
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
528 :$put =(l == l)
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
529 :$put =(d == d)
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
530 :$put =(l != deepcopy(l))
96cd8222a819 updated for version 7.1a
vimboss
parents: 842
diff changeset
531 :$put =(d != deepcopy(d))
2634
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
532 :"
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
533 :" compare complex recursively linked list and dict
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
534 :let l = []
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
535 :call add(l, l)
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
536 :let dict4 = {"l": l}
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
537 :call add(dict4.l, dict4)
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
538 :let lcopy = deepcopy(l)
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
539 :let dict4copy = deepcopy(dict4)
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
540 :$put =(l == lcopy)
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
541 :$put =(dict4 == dict4copy)
3508
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
542 :"
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
543 :" Pass the same List to extend()
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
544 :let l = [1, 2, 3, 4, 5]
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
545 :call extend(l, l)
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
546 :$put =string(l)
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
547 :"
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
548 :" Pass the same Dict to extend()
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
549 :let d = { 'a': {'b': 'B'}}
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
550 :call extend(d, d)
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
551 :$put =string(d)
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
552 :"
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
553 :" Pass the same Dict to extend() with "error"
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
554 :try
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
555 : call extend(d, d, "error")
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
556 :catch
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
557 : $put =v:exception[:15] . v:exception[-1:-1]
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
558 :endtry
02440d1fcc9a updated for version 7.3.516
Bram Moolenaar <bram@vim.org>
parents: 2634
diff changeset
559 :$put =string(d)
6422
9fbb9c60ab41 updated for version 7.4.541
Bram Moolenaar <bram@vim.org>
parents: 6166
diff changeset
560 :"
9fbb9c60ab41 updated for version 7.4.541
Bram Moolenaar <bram@vim.org>
parents: 6166
diff changeset
561 :" test for range assign
9fbb9c60ab41 updated for version 7.4.541
Bram Moolenaar <bram@vim.org>
parents: 6166
diff changeset
562 :let l = [0]
9fbb9c60ab41 updated for version 7.4.541
Bram Moolenaar <bram@vim.org>
parents: 6166
diff changeset
563 :let l[:] = [1, 2]
9fbb9c60ab41 updated for version 7.4.541
Bram Moolenaar <bram@vim.org>
parents: 6166
diff changeset
564 :$put =string(l)
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
565 :endfun
2634
fcb916bed51a updated for version 7.3.055
Bram Moolenaar <bram@vim.org>
parents: 1539
diff changeset
566 :"
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 123
diff changeset
567 :call Test(1, 2, [3, 4], {5: 6}) " This may take a while
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
568 :"
1405
b63792dadc23 updated for version 7.1-120
vimboss
parents: 1125
diff changeset
569 :delfunc Test
b63792dadc23 updated for version 7.1-120
vimboss
parents: 1125
diff changeset
570 :unlet dict
b63792dadc23 updated for version 7.1-120
vimboss
parents: 1125
diff changeset
571 :call garbagecollect(1)
b63792dadc23 updated for version 7.1-120
vimboss
parents: 1125
diff changeset
572 :"
3774
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
573 :" test for patch 7.3.637
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
574 :let a = 'No error caught'
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
575 :try|foldopen|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
576 o=a :"
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
577 :lang C
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
578 :redir => a
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
579 :try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
580 :redir END
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
581 o=a :"
1810ee914648 updated for version 7.3.645
Bram Moolenaar <bram@vim.org>
parents: 3508
diff changeset
582 :"
119
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
583 :/^start:/,$wq! test.out
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
584 ENDTEST
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
585
e8f07016e34d updated for version 7.0042
vimboss
parents:
diff changeset
586 start: