Mercurial > vim
annotate src/testdir/test62.in @ 5130:71e066e10a47 v7.3.1308
updated for version 7.3.1308
Problem: Typos in MS-Windows build settings and README.
Solution: Minor changes to MS-Windows files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 04 Jul 2013 22:50:40 +0200 |
parents | c80838526eeb |
children | bea5eb942011 |
rev | line source |
---|---|
856 | 1 Tests for tab pages |
2 | |
3 STARTTEST | |
4 :so small.vim | |
5 :" Simple test for opening and closing a tab page | |
6 :tabnew | |
7 :let nr = tabpagenr() | |
8 :q | |
9 :call append(line('$'), 'tab page ' . nr) | |
1405 | 10 :unlet nr |
856 | 11 :" |
12 :" Open three tab pages and use ":tabdo" | |
13 :0tabnew | |
14 :1tabnew | |
15 :888tabnew | |
16 :tabdo call append(line('$'), 'this is tab page ' . tabpagenr()) | |
17 :tabclose! 2 | |
18 :tabrewind | |
19 :let line1 = getline('$') | |
20 :undo | |
21 :q | |
22 :tablast | |
23 :let line2 = getline('$') | |
24 :q! | |
25 :call append(line('$'), line1) | |
26 :call append(line('$'), line2) | |
1405 | 27 :unlet line1 line2 |
856 | 28 :" |
2240
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
29 :" Test for settabvar() and gettabvar() functions. Open a new tab page and |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
30 :" set 3 variables to a number, string and a list. Verify that the variables |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
31 :" are correctly set. |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
32 :tabnew |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
33 :tabfirst |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
34 :call settabvar(2, 'val_num', 100) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
35 :call settabvar(2, 'val_str', 'SetTabVar test') |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
36 :call settabvar(2, 'val_list', ['red', 'blue', 'green']) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
37 :" |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
38 :let test_status = 'gettabvar: fail' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
39 :if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test') && gettabvar(2, 'val_list') == ['red', 'blue', 'green']) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
40 : let test_status = 'gettabvar: pass' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
41 :endif |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
42 :call append(line('$'), test_status) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
43 :" |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
44 :tabnext 2 |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
45 :let test_status = 'settabvar: fail' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
46 :if t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green'] |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
47 : let test_status = 'settabvar: pass' |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
48 :endif |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
49 :tabclose |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
50 :call append(line('$'), test_status) |
6b4879aea261
Add test for gettabvar() and settabvar().
Bram Moolenaar <bram@vim.org>
parents:
1405
diff
changeset
|
51 :" |
3408 | 52 :if has('gui') || has('clientserver') |
3380 | 53 :" Test for ":tab drop exist-file" to keep current window. |
54 :sp test1 | |
55 :tab drop test1 | |
56 :let test_status = 'tab drop 1: fail' | |
57 :if tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1 | |
58 : let test_status = 'tab drop 1: pass' | |
59 :endif | |
60 :close | |
61 :call append(line('$'), test_status) | |
62 :" | |
63 :" | |
64 :" Test for ":tab drop new-file" to keep current window of tabpage 1. | |
65 :split | |
66 :tab drop newfile | |
67 :let test_status = 'tab drop 2: fail' | |
68 :if tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1 | |
69 : let test_status = 'tab drop 2: pass' | |
70 :endif | |
71 :tabclose | |
72 :q | |
73 :call append(line('$'), test_status) | |
74 :" | |
75 :" | |
76 :" Test for ":tab drop multi-opend-file" to keep current tabpage and window. | |
77 :new test1 | |
78 :tabnew | |
79 :new test1 | |
80 :tab drop test1 | |
81 :let test_status = 'tab drop 3: fail' | |
82 :if tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1 | |
83 : let test_status = 'tab drop 3: pass' | |
84 :endif | |
85 :tabclose | |
86 :q | |
87 :call append(line('$'), test_status) | |
3408 | 88 :else |
89 :" :drop not supported | |
90 :call append(line('$'), 'tab drop 1: pass') | |
91 :call append(line('$'), 'tab drop 2: pass') | |
92 :call append(line('$'), 'tab drop 3: pass') | |
93 :endif | |
3380 | 94 :" |
95 :" | |
3662 | 96 :for i in range(9) | tabnew | endfor |
97 1gt | |
98 Go=tabpagenr() | |
99 :tabmove 5 | |
100 i=tabpagenr() | |
101 :tabmove -2 | |
102 i=tabpagenr() | |
103 :tabmove +4 | |
104 i=tabpagenr() | |
105 :tabmove | |
106 i=tabpagenr() | |
107 :tabmove -20 | |
108 i=tabpagenr() | |
109 :tabmove +20 | |
110 i=tabpagenr() | |
111 :3tabmove | |
112 i=tabpagenr() | |
113 :7tabmove 5 | |
114 i=tabpagenr() | |
115 :let a='No error caught.' | |
116 :try | |
117 :tabmove foo | |
118 :catch E474 | |
119 :let a='E474 caught.' | |
120 :endtry | |
121 i=a | |
122 :" | |
4354 | 123 :" Test autocommands |
124 :tabonly! | |
125 :let g:r=[] | |
126 :command -nargs=1 -bar C :call add(g:r, '=== ' . <q-args> . ' ===')|<args> | |
127 :function Test() | |
128 let hasau=has('autocmd') | |
129 if hasau | |
130 autocmd TabEnter * :call add(g:r, 'TabEnter') | |
131 autocmd WinEnter * :call add(g:r, 'WinEnter') | |
132 autocmd BufEnter * :call add(g:r, 'BufEnter') | |
133 autocmd TabLeave * :call add(g:r, 'TabLeave') | |
134 autocmd WinLeave * :call add(g:r, 'WinLeave') | |
135 autocmd BufLeave * :call add(g:r, 'BufLeave') | |
136 endif | |
137 let t:a='a' | |
138 C tab split | |
139 if !hasau | |
140 let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter'] | |
141 endif | |
142 let t:a='b' | |
143 C tabnew | |
144 if !hasau | |
145 let g:r+=['WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'] | |
146 endif | |
147 let t:a='c' | |
148 call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")'))) | |
149 C call map(range(1, tabpagenr('$')), 'settabvar(v:val, "a", v:val*2)') | |
150 call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")'))) | |
151 let w:a='a' | |
152 C vsplit | |
153 if !hasau | |
154 let g:r+=['WinLeave', 'WinEnter'] | |
155 endif | |
156 let w:a='a' | |
157 let tabn=tabpagenr() | |
158 let winr=range(1, winnr('$')) | |
159 C tabnext 1 | |
160 if !hasau | |
161 let g:r+=['BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'] | |
162 endif | |
163 call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")'))) | |
164 C call map(copy(winr), 'settabwinvar('.tabn.', v:val, "a", v:val*2)') | |
165 call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")'))) | |
166 if hasau | |
167 augroup TabDestructive | |
168 autocmd TabEnter * :C tabnext 2 | C tabclose 3 | |
169 augroup END | |
170 C tabnext 3 | |
171 let g:r+=[tabpagenr().'/'.tabpagenr('$')] | |
172 autocmd! TabDestructive TabEnter | |
173 C tabnew | |
174 C tabnext 1 | |
175 autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3 | |
176 C tabnext 3 | |
177 let g:r+=[tabpagenr().'/'.tabpagenr('$')] | |
178 else | |
179 let g:r+=["=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","2/2","=== tabnew ===","WinLeave","TabLeave","WinEnter","TabEnter","BufLeave","BufEnter","=== tabnext 1 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","BufEnter","=== tabnext 3 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","BufLeave","WinLeave","TabLeave","WinEnter","TabEnter","=== tabnext 2 ===","=== tabclose 3 ===","BufEnter","=== tabclose 3 ===","2/2",] | |
180 endif | |
181 endfunction | |
182 :call Test() | |
183 :$ put =g:r | |
184 :" | |
3662 | 185 :" |
856 | 186 :/^Results/,$w! test.out |
187 :qa! | |
188 ENDTEST | |
189 | |
190 Results: |