annotate src/testdir/test_partial.vim @ 8591:5bc958a92849 v7.4.1585

commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 17 20:50:47 2016 +0100 patch 7.4.1585 Problem: Partial is not recognized everywhere. Solution: Check for partial in trans_function_name(). (Yasuhiro Matsumoto) Add a test.
author Christian Brabandt <cb@256bit.org>
date Thu, 17 Mar 2016 21:00:04 +0100
parents ce37bbedcb65
children dc36cef103de
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"]))
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
8548
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
24 let Cb = function('MyFunc', [])
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
25 call assert_equal("a/b/c", Cb("a", "b", "c"))
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
26
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let Sort = function('MySort', [1])
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 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
29 let Sort = function('MySort', [0])
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 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
31 endfunc
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 func MyDictFunc(arg1, arg2) dict
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 return self.name . '/' . a:arg1 . '/' . a:arg2
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endfunc
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 func Test_partial_dict()
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 let dict = {'name': 'hello'}
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 let Cb = function('MyDictFunc', ["foo", "bar"], dict)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal("hello/foo/bar", Cb())
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 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
42
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 let Cb = function('MyDictFunc', ["foo"], dict)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 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
45 call assert_fails('Cb()', 'E492:')
8548
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
46
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
47 let Cb = function('MyDictFunc', [], dict)
24db3583c496 commit https://github.com/vim/vim/commit/346418c624f1bc7c04c98907134a2b284e6452dd
Christian Brabandt <cb@256bit.org>
parents: 8546
diff changeset
48 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
49 call assert_fails('Cb("yyy")', 'E492:')
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', dict)
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 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
53 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
54
537bbbd4e987 commit https://github.com/vim/vim/commit/65639032bb7b17996cd255d1508a1df4ad528a1f
Christian Brabandt <cb@256bit.org>
parents: 8581
diff changeset
55 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
56 call assert_equal("Hello", dict.tr())
8538
c337c813c64d commit https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 endfunc
8575
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
58
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
59 func Test_partial_implicit()
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
60 let dict = {'name': 'foo'}
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
61 func dict.MyFunc(arg) dict
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
62 return self.name . '/' . a:arg
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
63 endfunc
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
64
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
65 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
66
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
67 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
68 let Func = dict.MyFunc
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
69 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
70
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
71 let Func = function(dict.MyFunc, ['bbb'])
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
72 call assert_equal('foo/bbb', Func())
b5209a4e5baf commit https://github.com/vim/vim/commit/ab1fa3955f25dfdb7e329c3bd76e175c93c8cb5e
Christian Brabandt <cb@256bit.org>
parents: 8548
diff changeset
73 endfunc
8581
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
74
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
75 fun InnerCall(funcref)
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
76 return a:funcref
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
77 endfu
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
78
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
79 fun OuterCall()
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
80 let opt = { 'func' : function('sin') }
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
81 call InnerCall(opt.func)
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
82 endfu
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
83
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
84 func Test_function_in_dict()
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
85 call OuterCall()
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
86 endfunc
fd454847836d commit https://github.com/vim/vim/commit/7a5c46a9df7ef01a4f6a620861c35400d5ad28d9
Christian Brabandt <cb@256bit.org>
parents: 8575
diff changeset
87
8585
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
88 function! s:cache_clear() dict
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
89 return self.name
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
90 endfunction
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
91
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
92 func Test_script_function_in_dict()
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
93 let s:obj = {'name': 'foo'}
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
94 let s:obj2 = {'name': 'bar'}
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
95
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
96 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
97
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
98 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
99 let F = s:obj.clear
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
100 call assert_equal('foo', F())
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
101 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
102 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
103
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
104 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
105 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
106 let B = s:obj2.clear
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
107 call assert_equal('bar', B())
ce37bbedcb65 commit https://github.com/vim/vim/commit/6f2e4b36c9d9908e1cace2b1b96e2c154a837bc2
Christian Brabandt <cb@256bit.org>
parents: 8583
diff changeset
108 endfunc
8591
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
109
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
110 func Test_partial_exists()
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
111 let F = function('MyFunc')
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
112 call assert_true(exists('*F'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
113 let lF = [F]
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
114 call assert_true(exists('*lF[0]'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
115
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
116 let F = function('MyFunc', ['arg'])
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
117 call assert_true(exists('*F'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
118 let lF = [F]
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
119 call assert_true(exists('*lF[0]'))
5bc958a92849 commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1
Christian Brabandt <cb@256bit.org>
parents: 8585
diff changeset
120 endfunc