annotate src/testdir/test_partial.vim @ 8712:65130a9d3386 v7.4.1645

commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 24 21:42:09 2016 +0100 patch 7.4.1645 Problem: When a dict contains a partial it can't be redefined as a function. (Nikolai Pavlov) Solution: Remove the partial when overwriting with a function.
author Christian Brabandt <cb@256bit.org>
date Thu, 24 Mar 2016 21:45:07 +0100
parents af3cb5c068fd
children a5224eeb3546
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test binding arguments to a Funcref.
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func MyFunc(arg1, arg2, arg3)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 return a:arg1 . '/' . a:arg2 . '/' . a:arg3
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endfunc
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func MySort(up, one, two)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 if a:one == a:two
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 return 0
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 endif
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 if a:up
8546
996109e24f02 commit https://github.com/vim/vim/commit/790500a8e65bee295ef51a59dfa67ecbaab8ea17
Christian Brabandt <cb@256bit.org>
parents: 8538
diff changeset
12 return a:one > a:two ? 1 : -1
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endif
8546
996109e24f02 commit https://github.com/vim/vim/commit/790500a8e65bee295ef51a59dfa67ecbaab8ea17
Christian Brabandt <cb@256bit.org>
parents: 8538
diff changeset
14 return a:one < a:two ? 1 : -1
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endfunc
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 func Test_partial_args()
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let Cb = function('MyFunc', ["foo", "bar"])
8583
537bbbd4e987 commit https://github.com/vim/vim/commit/65639032bb7b17996cd255d1508a1df4ad528a1f
Christian Brabandt <cb@256bit.org>
parents: 8581
diff changeset
19
537bbbd4e987 commit https://github.com/vim/vim/commit/65639032bb7b17996cd255d1508a1df4ad528a1f
Christian Brabandt <cb@256bit.org>
parents: 8581
diff changeset
20 call Cb("zzz")
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal("foo/bar/xxx", Cb("xxx"))
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal("foo/bar/yyy", call(Cb, ["yyy"]))
8593
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
23 let Cb2 = function(Cb)
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
24 call assert_equal("foo/bar/zzz", Cb2("zzz"))
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
25 let Cb3 = function(Cb, ["www"])
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
26 call assert_equal("foo/bar/www", Cb3())
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
8548
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
28 let Cb = function('MyFunc', [])
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
29 call assert_equal("a/b/c", Cb("a", "b", "c"))
8593
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
30 let Cb2 = function(Cb, [])
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
31 call assert_equal("a/b/d", Cb2("a", "b", "d"))
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
32 let Cb3 = function(Cb, ["a", "b"])
dc36cef103de commit https://github.com/vim/vim/commit/8a1bb046378f4bc68d6a04af2eab80fb3ce04da6
Christian Brabandt <cb@256bit.org>
parents: 8591
diff changeset
33 call assert_equal("a/b/e", Cb3("e"))
8548
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
34
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 let Sort = function('MySort', [1])
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal([1, 2, 3], sort([3, 1, 2], Sort))
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 let Sort = function('MySort', [0])
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal([3, 2, 1], sort([3, 1, 2], Sort))
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 endfunc
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 func MyDictFunc(arg1, arg2) dict
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 return self.name . '/' . a:arg1 . '/' . a:arg2
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 func Test_partial_dict()
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 let dict = {'name': 'hello'}
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 let Cb = function('MyDictFunc', ["foo", "bar"], dict)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call assert_equal("hello/foo/bar", Cb())
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call assert_fails('Cb("xxx")', 'E492:')
8548
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
50
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let Cb = function('MyDictFunc', ["foo"], dict)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_equal("hello/foo/xxx", Cb("xxx"))
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_fails('Cb()', 'E492:')
8548
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
54
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
55 let Cb = function('MyDictFunc', [], dict)
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
56 call assert_equal("hello/ttt/xxx", Cb("ttt", "xxx"))
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
57 call assert_fails('Cb("yyy")', 'E492:')
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
58
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 let Cb = function('MyDictFunc', dict)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call assert_equal("hello/xxx/yyy", Cb("xxx", "yyy"))
8548
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
61 call assert_fails('Cb("fff")', 'E492:')
8583
537bbbd4e987 commit https://github.com/vim/vim/commit/65639032bb7b17996cd255d1508a1df4ad528a1f
Christian Brabandt <cb@256bit.org>
parents: 8581
diff changeset
62
537bbbd4e987 commit https://github.com/vim/vim/commit/65639032bb7b17996cd255d1508a1df4ad528a1f
Christian Brabandt <cb@256bit.org>
parents: 8581
diff changeset
63 let dict = {"tr": function('tr', ['hello', 'h', 'H'])}
537bbbd4e987 commit https://github.com/vim/vim/commit/65639032bb7b17996cd255d1508a1df4ad528a1f
Christian Brabandt <cb@256bit.org>
parents: 8581
diff changeset
64 call assert_equal("Hello", dict.tr())
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 endfunc
8575
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
66
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
67 func Test_partial_implicit()
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
68 let dict = {'name': 'foo'}
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
69 func dict.MyFunc(arg) dict
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
70 return self.name . '/' . a:arg
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
71 endfunc
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
72
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
73 call assert_equal('foo/bar', dict.MyFunc('bar'))
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
74
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
75 call assert_fails('let func = dict.MyFunc', 'E704:')
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
76 let Func = dict.MyFunc
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
77 call assert_equal('foo/aaa', Func('aaa'))
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
78
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
79 let Func = function(dict.MyFunc, ['bbb'])
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
80 call assert_equal('foo/bbb', Func())
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
81 endfunc
8581
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
82
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
83 fun InnerCall(funcref)
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
84 return a:funcref
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
85 endfu
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
86
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
87 fun OuterCall()
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
88 let opt = { 'func' : function('sin') }
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
89 call InnerCall(opt.func)
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
90 endfu
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
91
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
92 func Test_function_in_dict()
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
93 call OuterCall()
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
94 endfunc
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
95
8585
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
96 function! s:cache_clear() dict
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
97 return self.name
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
98 endfunction
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
99
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
100 func Test_script_function_in_dict()
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
101 let s:obj = {'name': 'foo'}
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
102 let s:obj2 = {'name': 'bar'}
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
103
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
104 let s:obj['clear'] = function('s:cache_clear')
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
105
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
106 call assert_equal('foo', s:obj.clear())
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
107 let F = s:obj.clear
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
108 call assert_equal('foo', F())
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
109 call assert_equal('foo', call(s:obj.clear, [], s:obj))
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
110 call assert_equal('bar', call(s:obj.clear, [], s:obj2))
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
111
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
112 let s:obj2['clear'] = function('s:cache_clear')
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
113 call assert_equal('bar', s:obj2.clear())
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
114 let B = s:obj2.clear
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
115 call assert_equal('bar', B())
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
116 endfunc
8591
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
117
8599
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
118 function! s:cache_arg(arg) dict
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
119 let s:result = self.name . '/' . a:arg
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
120 return s:result
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
121 endfunction
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
122
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
123 func Test_script_function_in_dict_arg()
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
124 let s:obj = {'name': 'foo'}
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
125 let s:obj['clear'] = function('s:cache_arg')
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
126
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
127 call assert_equal('foo/bar', s:obj.clear('bar'))
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
128 let F = s:obj.clear
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
129 let s:result = ''
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
130 call assert_equal('foo/bar', F('bar'))
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
131 call assert_equal('foo/bar', s:result)
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
132
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
133 let s:obj['clear'] = function('s:cache_arg', ['bar'])
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
134 call assert_equal('foo/bar', s:obj.clear())
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
135 let s:result = ''
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
136 call s:obj.clear()
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
137 call assert_equal('foo/bar', s:result)
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
138
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
139 let F = s:obj.clear
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
140 call assert_equal('foo/bar', F())
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
141 let s:result = ''
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
142 call F()
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
143 call assert_equal('foo/bar', s:result)
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
144
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
145 call assert_equal('foo/bar', call(s:obj.clear, [], s:obj))
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
146 endfunc
ddb04cbe1e0c commit https://github.com/vim/vim/commit/9e63f61cb01c70fd71652f54b2d01ee27b2a3534
Christian Brabandt <cb@256bit.org>
parents: 8593
diff changeset
147
8591
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
148 func Test_partial_exists()
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
149 let F = function('MyFunc')
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
150 call assert_true(exists('*F'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
151 let lF = [F]
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
152 call assert_true(exists('*lF[0]'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
153
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
154 let F = function('MyFunc', ['arg'])
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
155 call assert_true(exists('*F'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
156 let lF = [F]
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
157 call assert_true(exists('*lF[0]'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
158 endfunc
8637
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
159
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
160 func Test_partial_string()
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
161 let F = function('MyFunc')
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
162 call assert_equal("function('MyFunc')", string(F))
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
163 let F = function('MyFunc', ['foo'])
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
164 call assert_equal("function('MyFunc', ['foo'])", string(F))
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
165 let F = function('MyFunc', ['foo', 'bar'])
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
166 call assert_equal("function('MyFunc', ['foo', 'bar'])", string(F))
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
167 let d = {'one': 1}
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
168 let F = function('MyFunc', d)
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
169 call assert_equal("function('MyFunc', {'one': 1})", string(F))
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
170 let F = function('MyFunc', ['foo'], d)
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
171 call assert_equal("function('MyFunc', ['foo'], {'one': 1})", string(F))
ff41ece2e4b8 commit https://github.com/vim/vim/commit/5c29154b521e9948190be653cfda666ecbb63b5b
Christian Brabandt <cb@256bit.org>
parents: 8599
diff changeset
172 endfunc
8698
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
173
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
174 func Test_func_unref()
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
175 let obj = {}
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
176 function! obj.func() abort
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
177 endfunction
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
178 let funcnumber = matchstr(string(obj.func), '^function(''\zs.\{-}\ze''')
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
179 call assert_true(exists('*{' . funcnumber . '}'))
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
180 unlet obj
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
181 call assert_false(exists('*{' . funcnumber . '}'))
13b0ed12a78a commit https://github.com/vim/vim/commit/e4eb6ff089e79e659acf33c17dd0fda7177de526
Christian Brabandt <cb@256bit.org>
parents: 8637
diff changeset
182 endfunc
8710
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
183
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
184 func Test_tostring()
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
185 let d = {}
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
186 let d.d = d
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
187 function d.test3()
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
188 echo 42
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
189 endfunction
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
190 try
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
191 call string(d.test3)
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
192 catch
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
193 call assert_true(v:false, v:exception)
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
194 endtry
af3cb5c068fd commit https://github.com/vim/vim/commit/24c77a1e3a2ad510582116229462b482d69b4b8e
Christian Brabandt <cb@256bit.org>
parents: 8698
diff changeset
195 endfunc
8712
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
196
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
197 func Test_redefine_dict_func()
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
198 let d = {}
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
199 function d.test4()
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
200 endfunction
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
201 let d.test4 = d.test4
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
202 try
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
203 function! d.test4(name)
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
204 endfunction
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
205 catch
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
206 call assert_true(v:errmsg, v:exception)
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
207 endtry
65130a9d3386 commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Christian Brabandt <cb@256bit.org>
parents: 8710
diff changeset
208 endfunc