4157
|
1 Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar().
|
|
2 vim: set ft=vim :
|
|
3
|
|
4 STARTTEST
|
|
5 :so small.vim
|
|
6 :"
|
|
7 :" test for getbufvar()
|
|
8 :let b:var_num = 1234
|
|
9 :let def_num = 5678
|
|
10 :$put =string(getbufvar(1, 'var_num'))
|
|
11 :$put =string(getbufvar(1, 'var_num', def_num))
|
|
12 :$put =string(getbufvar(1, ''))
|
|
13 :$put =string(getbufvar(1, '', def_num))
|
|
14 :unlet b:var_num
|
|
15 :$put =string(getbufvar(1, 'var_num', def_num))
|
|
16 :$put =string(getbufvar(1, ''))
|
|
17 :$put =string(getbufvar(1, '', def_num))
|
|
18 :$put =string(getbufvar(9, ''))
|
|
19 :$put =string(getbufvar(9, '', def_num))
|
|
20 :unlet def_num
|
|
21 :$put =string(getbufvar(1, '&autoindent'))
|
|
22 :$put =string(getbufvar(1, '&autoindent', 1))
|
|
23 :"
|
|
24 :" test for getwinvar()
|
|
25 :let w:var_str = "Dance"
|
|
26 :let def_str = "Chance"
|
|
27 :$put =string(getwinvar(1, 'var_str'))
|
|
28 :$put =string(getwinvar(1, 'var_str', def_str))
|
|
29 :$put =string(getwinvar(1, ''))
|
|
30 :$put =string(getwinvar(1, '', def_str))
|
|
31 :unlet w:var_str
|
|
32 :$put =string(getwinvar(1, 'var_str', def_str))
|
|
33 :$put =string(getwinvar(1, ''))
|
|
34 :$put =string(getwinvar(1, '', def_str))
|
|
35 :$put =string(getwinvar(9, ''))
|
|
36 :$put =string(getwinvar(9, '', def_str))
|
|
37 :$put =string(getwinvar(1, '&nu'))
|
|
38 :$put =string(getwinvar(1, '&nu', 1))
|
|
39 :unlet def_str
|
|
40 :"
|
|
41 :" test for gettabvar()
|
|
42 :tabnew
|
|
43 :tabnew
|
|
44 :let t:var_list = [1, 2, 3]
|
|
45 :let def_list = [4, 5, 6, 7]
|
|
46 :tabrewind
|
|
47 :$put =string(gettabvar(3, 'var_list'))
|
|
48 :$put =string(gettabvar(3, 'var_list', def_list))
|
|
49 :$put =string(gettabvar(3, ''))
|
|
50 :$put =string(gettabvar(3, '', def_list))
|
|
51 :tablast
|
|
52 :unlet t:var_list
|
|
53 :tabrewind
|
|
54 :$put =string(gettabvar(3, 'var_list', def_list))
|
|
55 :$put =string(gettabvar(9, ''))
|
|
56 :$put =string(gettabvar(9, '', def_list))
|
|
57 :$put =string(gettabvar(3, '&nu'))
|
|
58 :$put =string(gettabvar(3, '&nu', def_list))
|
|
59 :unlet def_list
|
|
60 :tabonly
|
|
61 :"
|
|
62 :" test for gettabwinvar()
|
|
63 :tabnew
|
|
64 :tabnew
|
|
65 :tabprev
|
|
66 :split
|
|
67 :split
|
|
68 :wincmd w
|
|
69 :vert split
|
|
70 :wincmd w
|
|
71 :let w:var_dict = {'dict': 'tabwin'}
|
|
72 :let def_dict = {'dict2': 'newval'}
|
|
73 :wincmd b
|
|
74 :tabrewind
|
|
75 :$put =string(gettabwinvar(2, 3, 'var_dict'))
|
|
76 :$put =string(gettabwinvar(2, 3, 'var_dict', def_dict))
|
|
77 :$put =string(gettabwinvar(2, 3, ''))
|
|
78 :$put =string(gettabwinvar(2, 3, '', def_dict))
|
|
79 :tabnext
|
|
80 :3wincmd w
|
|
81 :unlet w:var_dict
|
|
82 :tabrewind
|
|
83 :$put =string(gettabwinvar(2, 3, 'var_dict', def_dict))
|
|
84 :$put =string(gettabwinvar(2, 3, ''))
|
|
85 :$put =string(gettabwinvar(2, 3, '', def_dict))
|
|
86 :$put =string(gettabwinvar(2, 9, ''))
|
|
87 :$put =string(gettabwinvar(2, 9, '', def_dict))
|
|
88 :$put =string(gettabwinvar(9, 3, ''))
|
|
89 :$put =string(gettabwinvar(9, 3, '', def_dict))
|
|
90 :unlet def_dict
|
|
91 :$put =string(gettabwinvar(2, 3, '&nux'))
|
|
92 :$put =string(gettabwinvar(2, 3, '&nux', 1))
|
|
93 :tabonly
|
|
94 :"
|
|
95 :/^start/,$wq! test.out
|
|
96 ENDTEST
|
|
97
|
|
98 start:
|