annotate src/testdir/test_getvar.vim @ 18478:94223687df0e

Added tag v8.1.2233 for changeset e93cab5d0f0f27fad7882f1f412927df055b090d
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Oct 2019 04:30:05 +0100
parents 9fac6d0de69a
children 3856047f2211
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17534
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
1 " Tests for getwinvar(), gettabvar(), gettabwinvar() and get().
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
2
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_var()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 " Use strings to test for memory leaks. First, check that in an empty
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " window, gettabvar() returns the correct value
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 let t:testvar='abcd'
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call assert_equal('abcd', gettabvar(1, 'testvar'))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal('abcd', gettabvar(1, 'testvar'))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " test for getwinvar()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let w:var_str = "Dance"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 let def_str = "Chance"
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal('Dance', getwinvar(1, 'var_str'))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal('Dance', getwinvar(1, 'var_str', def_str))
17912
9fac6d0de69a patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
15 call assert_equal({'var_str': 'Dance'}, 1->getwinvar(''))
9fac6d0de69a patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
16 call assert_equal({'var_str': 'Dance'}, 1->getwinvar('', def_str))
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 unlet w:var_str
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal('Chance', getwinvar(1, 'var_str', def_str))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal({}, getwinvar(1, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal({}, getwinvar(1, '', def_str))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal('', getwinvar(9, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal('Chance', getwinvar(9, '', def_str))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal(0, getwinvar(1, '&nu'))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal(0, getwinvar(1, '&nu', 1))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 unlet def_str
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " test for gettabvar()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 tabnew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 tabnew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 let t:var_list = [1, 2, 3]
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let t:other = 777
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let def_list = [4, 5, 6, 7]
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 tabrewind
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17534
diff changeset
34 call assert_equal([1, 2, 3], 3->gettabvar('var_list'))
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal([1, 2, 3], gettabvar(3, 'var_list', def_list))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal({'var_list': [1, 2, 3], 'other': 777}, gettabvar(3, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal({'var_list': [1, 2, 3], 'other': 777},
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ gettabvar(3, '', def_list))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 tablast
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 unlet t:var_list
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 tabrewind
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal([4, 5, 6, 7], gettabvar(3, 'var_list', def_list))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal('', gettabvar(9, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal([4, 5, 6, 7], gettabvar(9, '', def_list))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal('', gettabvar(3, '&nu'))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call assert_equal([4, 5, 6, 7], gettabvar(3, '&nu', def_list))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 unlet def_list
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 tabonly
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " test for gettabwinvar()
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 tabnew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 tabnew
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 tabprev
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 split
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 split
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 wincmd w
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 vert split
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 wincmd w
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 let w:var_dict = {'dict': 'tabwin'}
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 let def_dict = {'dict2': 'newval'}
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 wincmd b
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 tabrewind
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17534
diff changeset
64 call assert_equal({'dict': 'tabwin'}, 2->gettabwinvar(3, 'var_dict'))
12019
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 call assert_equal({'dict': 'tabwin'},
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 \ gettabwinvar(2, 3, 'var_dict', def_dict))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 call assert_equal({'var_dict': {'dict': 'tabwin'}}, gettabwinvar(2, 3, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call assert_equal({'var_dict': {'dict': 'tabwin'}},
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 \ gettabwinvar(2, 3, '', def_dict))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 tabnext
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 3wincmd w
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 unlet w:var_dict
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 tabrewind
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal({'dict2': 'newval'},
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 \ gettabwinvar(2, 3, 'var_dict', def_dict))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal({}, gettabwinvar(2, 3, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal({}, gettabwinvar(2, 3, '', def_dict))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal("", gettabwinvar(2, 9, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call assert_equal({'dict2': 'newval'}, gettabwinvar(2, 9, '', def_dict))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call assert_equal('', gettabwinvar(9, 3, ''))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal({'dict2': 'newval'}, gettabwinvar(9, 3, '', def_dict))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 unlet def_dict
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal('', gettabwinvar(2, 3, '&nux'))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(1, gettabwinvar(2, 3, '&nux', 1))
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 tabonly
7d7835ab8b37 patch 8.0.0890: still many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 endfunc
12564
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
90
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
91 " It was discovered that "gettabvar()" would fail if called from within the
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
92 " tabline when the user closed a window. This test confirms the fix.
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
93 func Test_gettabvar_in_tabline()
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
94 let t:var_str = 'value'
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
95
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
96 set tabline=%{assert_equal('value',gettabvar(1,'var_str'))}
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
97 set showtabline=2
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
98
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
99 " Simulate the user opening a split (which becomes window #1) and then
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
100 " closing the split, which triggers the redrawing of the tabline.
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
101 leftabove split
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
102 redrawstatus!
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
103 close
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
104 redrawstatus!
183dc24cf861 patch 8.0.1160: getting tab-local variable fails after closing window
Christian Brabandt <cb@256bit.org>
parents: 12019
diff changeset
105 endfunc
17534
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
106
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
107 " Test get() function using default value.
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
108
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
109 " get({dict}, {key} [, {default}])
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
110 func Test_get_dict()
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
111 let d = {'foo': 42}
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
112 call assert_equal(42, get(d, 'foo', 99))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
113 call assert_equal(999, get(d, 'bar', 999))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
114 endfunc
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
115
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
116 " get({list}, {idx} [, {default}])
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
117 func Test_get_list()
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
118 let l = [1,2,3]
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
119 call assert_equal(1, get(l, 0, 999))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
120 call assert_equal(3, get(l, -1, 999))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
121 call assert_equal(999, get(l, 3, 999))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
122 endfunc
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
123
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
124 " get({blob}, {idx} [, {default}]) - in test_blob.vim
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
125
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
126 " get({lambda}, {what} [, {default}])
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
127 func Test_get_lambda()
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
128 let l:L = {-> 42}
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
129 call assert_match('^<lambda>', get(l:L, 'name'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
130 call assert_equal(l:L, get(l:L, 'func'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
131 call assert_equal({'lambda has': 'no dict'}, get(l:L, 'dict', {'lambda has': 'no dict'}))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
132 call assert_equal(0, get(l:L, 'dict'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
133 call assert_equal([], get(l:L, 'args'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
134 endfunc
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
135
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
136 " get({func}, {what} [, {default}])
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
137 func Test_get_func()
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
138 let l:F = function('tr')
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
139 call assert_equal('tr', get(l:F, 'name'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
140 call assert_equal(l:F, get(l:F, 'func'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
141 call assert_equal({'func has': 'no dict'}, get(l:F, 'dict', {'func has': 'no dict'}))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
142 call assert_equal(0, get(l:F, 'dict'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
143 call assert_equal([], get(l:F, 'args'))
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
144 endfunc
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
145
2b4c138bf8e9 patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 12564
diff changeset
146 " get({partial}, {what} [, {default}]) - in test_partial.vim