blob: 0e219e20bdda77e1b38a507f8e1c692ad02f388e [file] [log] [blame]
Bram Moolenaar1381d792016-08-18 22:11:42 +02001" Tests for tabpage
2
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +02003source screendump.vim
Bram Moolenaar5a4c3082019-12-01 15:23:11 +01004source check.vim
Bram Moolenaardbe88692018-05-20 14:57:22 +02005
Bram Moolenaar1381d792016-08-18 22:11:42 +02006function Test_tabpage()
Bram Moolenaar5a4c3082019-12-01 15:23:11 +01007 CheckFeature quickfix
8
Bram Moolenaar1381d792016-08-18 22:11:42 +02009 bw!
10 " Simple test for opening and closing a tab page
11 tabnew
12 call assert_equal(2, tabpagenr())
13 quit
14
15 " Open three tab pages and use ":tabdo"
16 0tabnew
17 1tabnew
18 $tabnew
Bram Moolenaar3e8474d2016-10-12 17:52:42 +020019 %del
Bram Moolenaar1381d792016-08-18 22:11:42 +020020 tabdo call append(line('$'), tabpagenr())
21 tabclose! 2
22 tabrewind
23 let line1 = getline('$')
24 undo
25 q
26 tablast
27 let line2 = getline('$')
28 q!
29 call append(line('$'), line1)
30 call append(line('$'), line2)
31 unlet line1 line2
32 call assert_equal(['', '3', '1', '4'], getline(1, '$'))
33 "
34 " Test for settabvar() and gettabvar() functions. Open a new tab page and
35 " set 3 variables to a number, string and a list. Verify that the variables
36 " are correctly set.
37 tabnew
38 tabfirst
39 call settabvar(2, 'val_num', 100)
Bram Moolenaaraad222c2019-09-06 22:46:09 +020040 eval 'SetTabVar test'->settabvar(2, 'val_str')
Bram Moolenaar1381d792016-08-18 22:11:42 +020041 call settabvar(2, 'val_list', ['red', 'blue', 'green'])
42 "
43 call assert_true(gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test' && gettabvar(2, 'val_list') == ['red', 'blue', 'green'])
44
45 tabnext 2
46 call assert_true(t:val_num == 100 && t:val_str == 'SetTabVar test' && t:val_list == ['red', 'blue', 'green'])
47 tabclose
48
Bram Moolenaar5a656862018-02-12 22:08:06 +010049 " Test for ":tab drop exist-file" to keep current window.
50 sp test1
51 tab drop test1
52 call assert_true(tabpagenr('$') == 1 && winnr('$') == 2 && winnr() == 1)
53 close
54 "
55 "
56 " Test for ":tab drop new-file" to keep current window of tabpage 1.
57 split
58 tab drop newfile
59 call assert_true(tabpagenr('$') == 2 && tabpagewinnr(1, '$') == 2 && tabpagewinnr(1) == 1)
60 tabclose
61 q
62 "
63 "
Bram Moolenaar1bc353b2019-09-01 14:45:28 +020064 " Test for ":tab drop multi-opened-file" to keep current tabpage and window.
Bram Moolenaar5a656862018-02-12 22:08:06 +010065 new test1
66 tabnew
67 new test1
68 tab drop test1
69 call assert_true(tabpagenr() == 2 && tabpagewinnr(2, '$') == 2 && tabpagewinnr(2) == 1)
70 tabclose
71 q
72 "
73 "
74 " Test for ":tab drop vertical-split-window" to jump test1 buffer
75 tabedit test1
76 vnew
77 tabfirst
78 tab drop test1
79 call assert_equal([2, 2, 2, 2], [tabpagenr('$'), tabpagenr(), tabpagewinnr(2, '$'), tabpagewinnr(2)])
80 1tabonly
Bram Moolenaar1381d792016-08-18 22:11:42 +020081 "
82 "
83 for i in range(9) | tabnew | endfor
84 normal! 1gt
85 call assert_equal(1, tabpagenr())
86 tabmove 5
87 call assert_equal(5, tabpagenr())
88 .tabmove
89 call assert_equal(5, tabpagenr())
90 tabmove -
91 call assert_equal(4, tabpagenr())
92 tabmove +
93 call assert_equal(5, tabpagenr())
94 tabmove -2
95 call assert_equal(3, tabpagenr())
96 tabmove +4
97 call assert_equal(7, tabpagenr())
98 tabmove
99 call assert_equal(10, tabpagenr())
Bram Moolenaar1381d792016-08-18 22:11:42 +0200100 0tabmove
101 call assert_equal(1, tabpagenr())
102 $tabmove
103 call assert_equal(10, tabpagenr())
104 tabmove 0
105 call assert_equal(1, tabpagenr())
106 tabmove $
107 call assert_equal(10, tabpagenr())
108 3tabmove
109 call assert_equal(4, tabpagenr())
110 7tabmove 5
111 call assert_equal(5, tabpagenr())
Bram Moolenaar82a12462019-01-22 22:41:42 +0100112 -tabmove
113 call assert_equal(4, tabpagenr())
114 +tabmove
115 call assert_equal(5, tabpagenr())
116 -2tabmove
117 call assert_equal(3, tabpagenr())
118 +3tabmove
119 call assert_equal(6, tabpagenr())
zeertzjq076faac2024-03-25 16:41:06 +0100120 silent -tabmove
121 call assert_equal(5, tabpagenr())
122 silent -2 tabmove
123 call assert_equal(3, tabpagenr())
124 silent -2 tabmove
125 call assert_equal(1, tabpagenr())
Bram Moolenaar7cc59652018-08-07 13:14:46 +0200126
Bram Moolenaar7cc59652018-08-07 13:14:46 +0200127 norm! 2gt
128 call assert_equal(2, tabpagenr())
zeertzjq076faac2024-03-25 16:41:06 +0100129 " The following are a no-op
Bram Moolenaar7cc59652018-08-07 13:14:46 +0200130 tabmove 2
131 call assert_equal(2, tabpagenr())
132 2tabmove
133 call assert_equal(2, tabpagenr())
134 tabmove 1
135 call assert_equal(2, tabpagenr())
136 1tabmove
137 call assert_equal(2, tabpagenr())
138
Bram Moolenaar62a23252020-08-09 14:04:42 +0200139 call assert_fails('let t = tabpagenr("@")', 'E15:')
Bram Moolenaar92b83cc2020-04-25 15:24:44 +0200140 call assert_equal(0, tabpagewinnr(-1))
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100141 call assert_fails("99tabmove", 'E16:')
142 call assert_fails("+99tabmove", 'E16:')
143 call assert_fails("-99tabmove", 'E16:')
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200144 call assert_fails("tabmove foo", 'E475:')
145 call assert_fails("tabmove 99", 'E475:')
146 call assert_fails("tabmove +99", 'E475:')
147 call assert_fails("tabmove -99", 'E475:')
148 call assert_fails("tabmove -3+", 'E475:')
149 call assert_fails("tabmove $3", 'E475:')
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100150 call assert_fails("%tabonly", 'E16:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100151 1tabonly!
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200152 tabmove 1
153 call assert_equal(1, tabpagenr())
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100154 tabnew
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200155 call assert_fails("-2tabmove", 'E16:')
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100156 tabonly!
Bram Moolenaar1381d792016-08-18 22:11:42 +0200157endfunc
158
Bram Moolenaar8281a162023-04-20 18:07:57 +0100159func Test_tabpage_drop()
160 edit f1
161 tab split f2
162 tab split f3
163 normal! gt
164 call assert_equal(1, tabpagenr())
glepnir2975a542024-02-09 19:30:26 +0100165 tab drop f4
166 call assert_equal(1, tabpagenr('#'))
Bram Moolenaar8281a162023-04-20 18:07:57 +0100167
168 tab drop f3
glepnir2975a542024-02-09 19:30:26 +0100169 call assert_equal(4, tabpagenr())
170 call assert_equal(2, tabpagenr('#'))
171 bwipe!
Bram Moolenaar8281a162023-04-20 18:07:57 +0100172 bwipe!
173 bwipe!
174 bwipe!
175 call assert_equal(1, tabpagenr('$'))
Rocco Maof96dc8d2024-01-23 21:27:19 +0100176
177 call assert_equal(1, winnr('$'))
178 call assert_equal('', bufname(''))
179 call writefile(['L1', 'L2'], 'Xdropfile', 'D')
180
181 " Test for ':tab drop single-file': reuse current buffer
182 let expected_nr = bufnr()
183 tab drop Xdropfile
184 call assert_equal(1, tabpagenr('$'))
185 call assert_equal(expected_nr, bufnr())
186 call assert_equal('L2', getline(2))
187 bwipe!
188
189 " Test for ':tab drop single-file': not reuse modified buffer
190 set modified
191 let expected_nr = bufnr() + 1
192 tab drop Xdropfile
193 call assert_equal(2, tabpagenr())
194 call assert_equal(2, tabpagenr('$'))
195 call assert_equal(expected_nr, bufnr())
196 call assert_equal('L2', getline(2))
197 bwipe!
198
199 " Test for ':tab drop single-file': multiple tabs already exist
200 tab split f2
201 tab split f3
202 let expected_nr = bufnr() + 1
203 tab drop Xdropfile
204 call assert_equal(4, tabpagenr())
205 call assert_equal(4, tabpagenr('$'))
206 call assert_equal(expected_nr, bufnr())
207 call assert_equal('L2', getline(2))
208 %bwipe!
209
210 " Test for ':tab drop multi-files': reuse current buffer
211 let expected_nr = bufnr()
212 tab drop Xdropfile f1 f2 f3
213 call assert_equal(1, tabpagenr())
214 call assert_equal(4, tabpagenr('$'))
215 call assert_equal(expected_nr, bufnr())
216 call assert_equal('L2', getline(2))
217 %bwipe!
218
219 " Test for ':tab drop multi-files': not reuse modified buffer
220 set modified
221 let expected_nr = bufnr() + 1
222 tab drop Xdropfile f1 f2 f3
223 call assert_equal(2, tabpagenr())
224 call assert_equal(5, tabpagenr('$'))
225 call assert_equal(expected_nr, bufnr())
226 call assert_equal('L2', getline(2))
227 %bwipe!
228
229 " Test for ':tab drop multi-files': multiple tabs already exist
230 tab split f2
231 tab split f3
232 let expected_nr = bufnr() + 1
233 tab drop a b c
234 call assert_equal(4, tabpagenr())
235 call assert_equal(6, tabpagenr('$'))
236 call assert_equal(expected_nr, bufnr())
237 let expected_nr = bufnr() + 3
238 tab drop Xdropfile f1 f2 f3
239 call assert_equal(5, tabpagenr())
240 call assert_equal(8, tabpagenr('$'))
241 call assert_equal(expected_nr, bufnr())
242 call assert_equal('L2', getline(2))
243 %bwipe!
Bram Moolenaar8281a162023-04-20 18:07:57 +0100244endfunc
245
Bram Moolenaar1381d792016-08-18 22:11:42 +0200246" Test autocommands
247function Test_tabpage_with_autocmd()
Bram Moolenaar1381d792016-08-18 22:11:42 +0200248 command -nargs=1 -bar C :call add(s:li, '=== ' . <q-args> . ' ===')|<args>
249 augroup TestTabpageGroup
250 au!
251 autocmd TabEnter * call add(s:li, 'TabEnter')
252 autocmd WinEnter * call add(s:li, 'WinEnter')
253 autocmd BufEnter * call add(s:li, 'BufEnter')
254 autocmd TabLeave * call add(s:li, 'TabLeave')
255 autocmd WinLeave * call add(s:li, 'WinLeave')
256 autocmd BufLeave * call add(s:li, 'BufLeave')
257 augroup END
258
259 let s:li = []
260 let t:a='a'
261 C tab split
262 call assert_equal(['=== tab split ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter'], s:li)
263 let s:li = []
264 let t:a='b'
265 C tabnew
266 call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li)
267 let t:a='c'
268 let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+')
269 call assert_equal(['a', 'b', 'c'], s:li)
270
271 let s:li = []
272 C call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)')
273 call assert_equal(["=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') ==="], s:li)
274 let s:li = split(join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')) , '\s\+')
275 call assert_equal(['2', '4', '6'], s:li)
276
277 let s:li = []
278 let w:a='a'
279 C vsplit
280 call assert_equal(['=== vsplit ===', 'WinLeave', 'WinEnter'], s:li)
281 let s:li = []
282 let w:a='a'
283 let tabn=tabpagenr()
284 let winr=range(1, winnr('$'))
285 C tabnext 1
286 call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li)
287 let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+')
288 call assert_equal(['a', 'a'], s:li)
289 let s:li = []
Bram Moolenaaraad222c2019-09-06 22:46:09 +0200290 C call map(copy(winr), '(v:val*2)->settabwinvar(' .. tabn .. ', v:val, ''a'')')
Bram Moolenaar1381d792016-08-18 22:11:42 +0200291 let s:li = split(join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')), '\s\+')
292 call assert_equal(['2', '4'], s:li)
293
294 augroup TabDestructive
295 autocmd TabEnter * :C tabnext 2 | C tabclose 3
296 augroup END
297 let s:li = []
298 C tabnext 3
299 call assert_equal(['=== tabnext 3 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li)
300 call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')])
301
302 autocmd! TabDestructive TabEnter
303 let s:li = []
304 C tabnew
305 call assert_equal(['=== tabnew ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufLeave', 'BufEnter'], s:li)
306 let s:li = []
307 C tabnext 1
308 call assert_equal(['=== tabnext 1 ===', 'BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter'], s:li)
309
310 autocmd TabDestructive TabEnter * nested :C tabnext 2 | C tabclose 3
311 let s:li = []
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100312 call assert_equal(3, tabpagenr('$'))
313 C tabnext 2
314 call assert_equal(2, tabpagenr('$'))
315 call assert_equal(['=== tabnext 2 ===', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', '=== tabnext 2 ===', '=== tabclose 3 ==='], s:li)
Bram Moolenaar1381d792016-08-18 22:11:42 +0200316 call assert_equal(['2/2'], [tabpagenr().'/'.tabpagenr('$')])
317
318 delcommand C
319 autocmd! TabDestructive
320 augroup! TabDestructive
321 autocmd! TestTabpageGroup
322 augroup! TestTabpageGroup
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100323 1tabonly!
Bram Moolenaar1381d792016-08-18 22:11:42 +0200324endfunction
325
Bram Moolenaarc10b5212020-01-13 20:54:51 +0100326" Test autocommands on tab drop
327function Test_tabpage_with_autocmd_tab_drop()
328 augroup TestTabpageGroup
329 au!
330 autocmd TabEnter * call add(s:li, 'TabEnter')
331 autocmd WinEnter * call add(s:li, 'WinEnter')
332 autocmd BufEnter * call add(s:li, 'BufEnter')
333 autocmd TabLeave * call add(s:li, 'TabLeave')
334 autocmd WinLeave * call add(s:li, 'WinLeave')
335 autocmd BufLeave * call add(s:li, 'BufLeave')
336 augroup END
337
338 let s:li = []
339 tab drop test1
Rocco Maof96dc8d2024-01-23 21:27:19 +0100340 call assert_equal(['BufEnter'], s:li)
Bram Moolenaarc10b5212020-01-13 20:54:51 +0100341
342 let s:li = []
343 tab drop test2 test3
344 call assert_equal([
345 \ 'TabLeave', 'TabEnter', 'TabLeave', 'TabEnter',
346 \ 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter',
Rocco Maof96dc8d2024-01-23 21:27:19 +0100347 \ 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter', 'BufEnter'], s:li)
Bram Moolenaarc10b5212020-01-13 20:54:51 +0100348
349 autocmd! TestTabpageGroup
350 augroup! TestTabpageGroup
351 1tabonly!
352endfunction
353
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200354function Test_tabpage_with_tab_modifier()
Bram Moolenaar5a4c3082019-12-01 15:23:11 +0100355 CheckFeature quickfix
356
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200357 for n in range(4)
358 tabedit
359 endfor
360
361 function s:check_tab(pre_nr, cmd, post_nr)
362 exec 'tabnext ' . a:pre_nr
363 exec a:cmd
364 call assert_equal(a:post_nr, tabpagenr())
Bram Moolenaar100f5c92016-09-06 21:33:52 +0200365 call assert_equal('help', &buftype)
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200366 helpclose
367 endfunc
368
369 call s:check_tab(1, 'tab help', 2)
370 call s:check_tab(1, '3tab help', 4)
371 call s:check_tab(1, '.tab help', 2)
372 call s:check_tab(1, '.+1tab help', 3)
373 call s:check_tab(1, '0tab help', 1)
374 call s:check_tab(2, '+tab help', 4)
375 call s:check_tab(2, '+2tab help', 5)
376 call s:check_tab(4, '-tab help', 4)
377 call s:check_tab(4, '-2tab help', 3)
378 call s:check_tab(3, '$tab help', 6)
379 call assert_fails('99tab help', 'E16:')
380 call assert_fails('+99tab help', 'E16:')
381 call assert_fails('-99tab help', 'E16:')
382
383 delfunction s:check_tab
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100384 1tabonly!
385endfunction
386
387function Check_tab_count(pre_nr, cmd, post_nr)
388 exec 'tabnext' a:pre_nr
389 normal! G
390 exec a:cmd
391 call assert_equal(a:post_nr, tabpagenr(), a:cmd)
392endfunc
393
394" Test for [count] of tabnext
395function Test_tabpage_with_tabnext()
396 for n in range(4)
397 tabedit
398 call setline(1, ['', '', '3'])
399 endfor
400
401 call Check_tab_count(1, 'tabnext', 2)
402 call Check_tab_count(1, '3tabnext', 3)
403 call Check_tab_count(1, '.tabnext', 1)
404 call Check_tab_count(1, '.+1tabnext', 2)
405 call Check_tab_count(2, '+tabnext', 3)
406 call Check_tab_count(2, '+2tabnext', 4)
407 call Check_tab_count(4, '-tabnext', 3)
408 call Check_tab_count(4, '-2tabnext', 2)
409 call Check_tab_count(3, '$tabnext', 5)
410 call assert_fails('0tabnext', 'E16:')
411 call assert_fails('99tabnext', 'E16:')
412 call assert_fails('+99tabnext', 'E16:')
413 call assert_fails('-99tabnext', 'E16:')
414 call Check_tab_count(1, 'tabnext 3', 3)
415 call Check_tab_count(2, 'tabnext +', 3)
416 call Check_tab_count(2, 'tabnext +2', 4)
417 call Check_tab_count(4, 'tabnext -', 3)
418 call Check_tab_count(4, 'tabnext -2', 2)
419 call Check_tab_count(3, 'tabnext $', 5)
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200420 call assert_fails('tabnext 0', 'E475:')
421 call assert_fails('tabnext .', 'E475:')
422 call assert_fails('tabnext -+', 'E475:')
423 call assert_fails('tabnext +2-', 'E475:')
424 call assert_fails('tabnext $3', 'E475:')
425 call assert_fails('tabnext 99', 'E475:')
426 call assert_fails('tabnext +99', 'E475:')
427 call assert_fails('tabnext -99', 'E475:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100428
429 1tabonly!
430endfunction
431
432" Test for [count] of tabprevious
433function Test_tabpage_with_tabprevious()
434 for n in range(5)
435 tabedit
436 call setline(1, ['', '', '3'])
437 endfor
438
439 for cmd in ['tabNext', 'tabprevious']
440 call Check_tab_count(6, cmd, 5)
441 call Check_tab_count(6, '3' . cmd, 3)
442 call Check_tab_count(6, '8' . cmd, 4)
443 call Check_tab_count(6, cmd . ' 3', 3)
444 call Check_tab_count(6, cmd . ' 8', 4)
445 for n in range(2)
Bram Moolenaar9d489562020-07-30 20:08:50 +0200446 for c in ['0', '.+3', '+', '+2', '-', '-2', '$', '+99', '-99']
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100447 if n == 0 " pre count
448 let entire_cmd = c . cmd
449 let err_code = 'E16:'
450 else
451 let entire_cmd = cmd . ' ' . c
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200452 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100453 endif
454 call assert_fails(entire_cmd, err_code)
455 endfor
456 endfor
457 endfor
458
459 1tabonly!
460endfunction
461
462function s:reconstruct_tabpage_for_test(nr)
463 let n = (a:nr > 2) ? a:nr - 2 : 1
464 1tabonly!
465 0tabedit n0
466 for n in range(1, n)
467 exec '$tabedit n' . n
468 if n == 1
469 call setline(1, ['', '', '3'])
470 endif
471 endfor
472endfunc
473
Bram Moolenaardbe88692018-05-20 14:57:22 +0200474func Test_tabpage_ctrl_pgup_pgdown()
475 enew!
476 tabnew tab1
477 tabnew tab2
478
479 call assert_equal(3, tabpagenr())
480 exe "norm! \<C-PageUp>"
481 call assert_equal(2, tabpagenr())
482 exe "norm! \<C-PageDown>"
483 call assert_equal(3, tabpagenr())
484
485 " Check wrapping at last or first page.
486 exe "norm! \<C-PageDown>"
487 call assert_equal(1, tabpagenr())
488 exe "norm! \<C-PageUp>"
489 call assert_equal(3, tabpagenr())
490
491 " With a count, <C-PageUp> and <C-PageDown> are not symmetrical somehow:
492 " - {count}<C-PageUp> goes {count} pages downward (relative count)
493 " - {count}<C-PageDown> goes to page number {count} (absolute count)
494 exe "norm! 2\<C-PageUp>"
495 call assert_equal(1, tabpagenr())
496 exe "norm! 2\<C-PageDown>"
497 call assert_equal(2, tabpagenr())
498
499 1tabonly!
500endfunc
501
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100502" Test for [count] of tabclose
503function Test_tabpage_with_tabclose()
504
505 " pre count
506 call s:reconstruct_tabpage_for_test(6)
507 call Check_tab_count(3, 'tabclose!', 3)
508 call Check_tab_count(1, '3tabclose', 1)
509 call Check_tab_count(4, '4tabclose', 3)
510 call Check_tab_count(3, '1tabclose', 2)
511 call Check_tab_count(2, 'tabclose', 1)
512 call assert_equal(1, tabpagenr('$'))
513 call assert_equal('', bufname(''))
514
515 call s:reconstruct_tabpage_for_test(6)
516 call Check_tab_count(2, '$tabclose', 2)
517 call Check_tab_count(4, '.tabclose', 4)
518 call Check_tab_count(3, '.+tabclose', 3)
519 call Check_tab_count(3, '.-2tabclose', 2)
520 call Check_tab_count(1, '.+1tabclose!', 1)
521 call assert_equal(1, tabpagenr('$'))
522 call assert_equal('', bufname(''))
523
524 " post count
525 call s:reconstruct_tabpage_for_test(6)
526 call Check_tab_count(3, 'tabclose!', 3)
527 call Check_tab_count(1, 'tabclose 3', 1)
528 call Check_tab_count(4, 'tabclose 4', 3)
529 call Check_tab_count(3, 'tabclose 1', 2)
530 call Check_tab_count(2, 'tabclose', 1)
531 call assert_equal(1, tabpagenr('$'))
532 call assert_equal('', bufname(''))
533
534 call s:reconstruct_tabpage_for_test(6)
535 call Check_tab_count(2, 'tabclose $', 2)
536 call Check_tab_count(4, 'tabclose', 4)
537 call Check_tab_count(3, 'tabclose +', 3)
538 call Check_tab_count(3, 'tabclose -2', 2)
539 call Check_tab_count(1, 'tabclose! +1', 1)
540 call assert_equal(1, tabpagenr('$'))
541 call assert_equal('', bufname(''))
542
543 call s:reconstruct_tabpage_for_test(6)
544 for n in range(2)
545 for c in ['0', '$3', '99', '+99', '-99']
546 if n == 0 " pre count
547 let entire_cmd = c . 'tabclose'
548 let err_code = 'E16:'
549 else
550 let entire_cmd = 'tabclose ' . c
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200551 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100552 endif
553 call assert_fails(entire_cmd, err_code)
554 call assert_equal(6, tabpagenr('$'))
555 endfor
556 endfor
557
558 call assert_fails('3tabclose', 'E37:')
559 call assert_fails('tabclose 3', 'E37:')
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200560 call assert_fails('tabclose -+', 'E475:')
561 call assert_fails('tabclose +2-', 'E475:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100562 call assert_equal(6, tabpagenr('$'))
563
564 1tabonly!
565endfunction
566
567" Test for [count] of tabonly
568function Test_tabpage_with_tabonly()
569
570 " Test for the normal behavior (pre count only)
571 let tc = [ [4, '.', '!'], [2, '.+', ''], [3, '.-2', '!'], [1, '.+1', '!'] ]
572 for c in tc
573 call s:reconstruct_tabpage_for_test(6)
574 let entire_cmd = c[1] . 'tabonly' . c[2]
575 call Check_tab_count(c[0], entire_cmd, 1)
576 call assert_equal(1, tabpagenr('$'))
577 endfor
578
579 " Test for the normal behavior
580 let tc2 = [ [3, '', ''], [1, '3', ''], [4, '4', '!'], [3, '1', '!'],
581 \ [2, '', '!'],
582 \ [2, '$', '!'], [3, '+', '!'], [3, '-2', '!'], [3, '+1', '!']
583 \ ]
584 for n in range(2)
585 for c in tc2
586 call s:reconstruct_tabpage_for_test(6)
587 if n == 0 " pre count
588 let entire_cmd = c[1] . 'tabonly' . c[2]
589 else
590 let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
591 endif
592 call Check_tab_count(c[0], entire_cmd, 1)
593 call assert_equal(1, tabpagenr('$'))
594 endfor
595 endfor
596
597 " Test for the error behavior
598 for n in range(2)
599 for c in ['0', '$3', '99', '+99', '-99']
600 call s:reconstruct_tabpage_for_test(6)
601 if n == 0 " pre count
602 let entire_cmd = c . 'tabonly'
603 let err_code = 'E16:'
604 else
605 let entire_cmd = 'tabonly ' . c
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200606 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100607 endif
608 call assert_fails(entire_cmd, err_code)
609 call assert_equal(6, tabpagenr('$'))
610 endfor
611 endfor
612
613 " Test for the error behavior (post count only)
614 for c in tc
615 call s:reconstruct_tabpage_for_test(6)
616 let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200617 let err_code = 'E475:'
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100618 call assert_fails(entire_cmd, err_code)
619 call assert_equal(6, tabpagenr('$'))
620 endfor
621
Bram Moolenaar8930caa2020-07-23 16:37:03 +0200622 call assert_fails('tabonly -+', 'E475:')
623 call assert_fails('tabonly +2-', 'E475:')
Bram Moolenaar2f72c702017-01-29 14:48:10 +0100624 call assert_equal(6, tabpagenr('$'))
625
626 1tabonly!
627 new
628 only!
Bram Moolenaar9b7f8ce2016-08-21 19:07:17 +0200629endfunction
630
Bram Moolenaar5a497892016-09-03 16:29:04 +0200631func Test_tabnext_on_buf_unload1()
Bram Moolenaar11fbc282016-09-02 21:48:32 +0200632 " This once caused a crash
633 new
634 tabedit
635 tabfirst
636 au BufUnload <buffer> tabnext
637 q
638
639 while tabpagenr('$') > 1
Bram Moolenaar5a497892016-09-03 16:29:04 +0200640 bwipe!
641 endwhile
642endfunc
643
644func Test_tabnext_on_buf_unload2()
645 " This once caused a crash
646 tabedit
647 autocmd BufUnload <buffer> tabnext
648 file x
649 edit y
650
651 while tabpagenr('$') > 1
652 bwipe!
Bram Moolenaar11fbc282016-09-02 21:48:32 +0200653 endwhile
654endfunc
655
Bram Moolenaar0ea50702017-07-08 14:44:50 +0200656func Test_close_on_quitpre()
657 " This once caused a crash
Bram Moolenaarce11de82017-10-26 22:00:00 +0200658 edit Xtest
Bram Moolenaar0ea50702017-07-08 14:44:50 +0200659 new
660 only
661 set bufhidden=delete
662 au QuitPre <buffer> close
663 tabnew tab1
664 tabnew tab2
665 1tabn
666 q!
667 call assert_equal(1, tabpagenr())
668 call assert_equal(2, tabpagenr('$'))
669 " clean up
670 while tabpagenr('$') > 1
671 bwipe!
672 endwhile
Bram Moolenaarce11de82017-10-26 22:00:00 +0200673 buf Xtest
Bram Moolenaar0ea50702017-07-08 14:44:50 +0200674endfunc
Bram Moolenaar11fbc282016-09-02 21:48:32 +0200675
Bram Moolenaardbe88692018-05-20 14:57:22 +0200676func Test_tabs()
677 enew!
678 tabnew tab1
679 norm ixxx
680 let a=split(execute(':tabs'), "\n")
681 call assert_equal(['Tab page 1',
682 \ ' [No Name]',
683 \ 'Tab page 2',
684 \ '> + tab1'], a)
685
686 1tabonly!
687 bw!
688endfunc
689
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200690func Test_tabpage_cmdheight()
Drew Vogelea67ba72025-05-07 22:05:17 +0200691 CheckScreendump
Bram Moolenaar494e9062020-05-31 21:28:02 +0200692 CheckRunVimInTerminal
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200693 call writefile([
694 \ 'set laststatus=2',
695 \ 'set cmdheight=2',
696 \ 'tabnew',
697 \ 'set cmdheight=3',
698 \ 'tabnext',
699 \ 'redraw!',
700 \ 'echo "hello\nthere"',
701 \ 'tabnext',
702 \ 'redraw',
Bram Moolenaarc4860bd2022-10-15 20:52:26 +0100703 \ ], 'XTest_tabpage_cmdheight', 'D')
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200704 " Check that cursor line is concealed
705 let buf = RunVimInTerminal('-S XTest_tabpage_cmdheight', {'statusoff': 3})
706 call VerifyScreenDump(buf, 'Test_tabpage_cmdheight', {})
707
708 call StopVimInTerminal(buf)
Bram Moolenaar0fef0ae2019-05-01 20:30:40 +0200709endfunc
710
Bram Moolenaarbc2b71d2020-02-17 21:33:30 +0100711" Test for closing the tab page from a command window
712func Test_tabpage_close_cmdwin()
713 tabnew
714 call feedkeys("q/:tabclose\<CR>\<Esc>", 'xt')
715 call assert_equal(2, tabpagenr('$'))
716 call feedkeys("q/:tabonly\<CR>\<Esc>", 'xt')
717 call assert_equal(2, tabpagenr('$'))
718 tabonly
719endfunc
720
Bram Moolenaar845e0ee2020-06-20 16:05:32 +0200721" Pressing <C-PageUp> in insert mode should go to the previous tab page
722" and <C-PageDown> should go to the next tab page
723func Test_tabpage_Ctrl_Pageup()
724 tabnew
725 call feedkeys("i\<C-PageUp>", 'xt')
726 call assert_equal(1, tabpagenr())
727 call feedkeys("i\<C-PageDown>", 'xt')
728 call assert_equal(2, tabpagenr())
729 %bw!
730endfunc
731
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200732" Return the terminal key code for selecting a tab page from the tabline. This
733" sequence contains the following codes: a CSI (0x9b), KS_TABLINE (0xf0),
734" KS_FILLER (0x58) and then the tab page number.
735func TabLineSelectPageCode(tabnr)
736 return "\x9b\xf0\x58" .. nr2char(a:tabnr)
737endfunc
738
739" Return the terminal key code for opening a new tabpage from the tabpage
740" menu. This sequence consists of the following codes: a CSI (0x9b),
741" KS_TABMENU (0xef), KS_FILLER (0x58), the tab page number and
742" TABLINE_MENU_NEW (2).
743func TabMenuNewItemCode(tabnr)
744 return "\x9b\xef\x58" .. nr2char(a:tabnr) .. nr2char(2)
745endfunc
746
747" Return the terminal key code for closing a tabpage from the tabpage menu.
748" This sequence consists of the following codes: a CSI (0x9b), KS_TABMENU
749" (0xef), KS_FILLER (0x58), the tab page number and TABLINE_MENU_CLOSE (1).
750func TabMenuCloseItemCode(tabnr)
751 return "\x9b\xef\x58" .. nr2char(a:tabnr) .. nr2char(1)
752endfunc
753
754" Test for using the tabpage menu from the insert and normal modes
755func Test_tabline_tabmenu()
756 " only works in GUI
757 CheckGui
758
759 %bw!
760 tabnew
761 tabnew
762 call assert_equal(3, tabpagenr())
763
764 " go to tab page 2 in normal mode
765 call feedkeys(TabLineSelectPageCode(2), "Lx!")
766 call assert_equal(2, tabpagenr())
767
768 " close tab page 3 in normal mode
769 call feedkeys(TabMenuCloseItemCode(3), "Lx!")
770 call assert_equal(2, tabpagenr('$'))
771 call assert_equal(2, tabpagenr())
772
773 " open new tab page before tab page 1 in normal mode
774 call feedkeys(TabMenuNewItemCode(1), "Lx!")
775 call assert_equal(1, tabpagenr())
776 call assert_equal(3, tabpagenr('$'))
777
778 " go to tab page 2 in operator-pending mode (should beep)
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200779 call assert_beeps('call feedkeys("c" .. TabLineSelectPageCode(2), "Lx!")')
780 call assert_equal(2, tabpagenr())
781 call assert_equal(3, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200782
783 " open new tab page before tab page 1 in operator-pending mode (should beep)
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200784 call assert_beeps('call feedkeys("c" .. TabMenuNewItemCode(1), "Lx!")')
785 call assert_equal(1, tabpagenr())
786 call assert_equal(4, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200787
788 " open new tab page after tab page 3 in normal mode
789 call feedkeys(TabMenuNewItemCode(4), "Lx!")
790 call assert_equal(4, tabpagenr())
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200791 call assert_equal(5, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200792
793 " go to tab page 2 in insert mode
794 call feedkeys("i" .. TabLineSelectPageCode(2) .. "\<C-C>", "Lx!")
795 call assert_equal(2, tabpagenr())
796
797 " close tab page 2 in insert mode
798 call feedkeys("i" .. TabMenuCloseItemCode(2) .. "\<C-C>", "Lx!")
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200799 call assert_equal(4, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200800
801 " open new tab page before tab page 3 in insert mode
802 call feedkeys("i" .. TabMenuNewItemCode(3) .. "\<C-C>", "Lx!")
803 call assert_equal(3, tabpagenr())
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200804 call assert_equal(5, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200805
806 " open new tab page after tab page 4 in insert mode
807 call feedkeys("i" .. TabMenuNewItemCode(5) .. "\<C-C>", "Lx!")
808 call assert_equal(5, tabpagenr())
Bram Moolenaard1ad99b2020-10-04 16:16:54 +0200809 call assert_equal(6, tabpagenr('$'))
Bram Moolenaar8c524f72020-06-21 13:23:45 +0200810
811 %bw!
812endfunc
813
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200814" Test for changing the current tab page from an autocmd when closing a tab
815" page.
816func Test_tabpage_switchtab_on_close()
817 only
818 tabnew
819 tabnew
820 " Test for BufLeave
821 augroup T1
822 au!
823 au BufLeave * tabfirst
824 augroup END
825 tabclose
826 call assert_equal(1, tabpagenr())
827 augroup T1
828 au!
829 augroup END
830
831 " Test for WinLeave
832 $tabnew
833 augroup T1
834 au!
835 au WinLeave * tabfirst
836 augroup END
837 tabclose
838 call assert_equal(1, tabpagenr())
839 augroup T1
840 au!
841 augroup END
842
843 " Test for TabLeave
844 $tabnew
845 augroup T1
846 au!
847 au TabLeave * tabfirst
848 augroup END
849 tabclose
850 call assert_equal(1, tabpagenr())
851 augroup T1
852 au!
853 augroup END
854 augroup! T1
855 tabonly
856endfunc
857
858" Test for closing the destination tabpage when jumping from one to another.
859func Test_tabpage_close_on_switch()
860 tabnew
861 tabnew
Bram Moolenaarb18b4962022-09-02 21:55:50 +0100862 edit Xtabfile
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200863 augroup T2
864 au!
Bram Moolenaarb18b4962022-09-02 21:55:50 +0100865 au BufLeave Xtabfile 1tabclose
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200866 augroup END
867 tabfirst
868 call assert_equal(2, tabpagenr())
Bram Moolenaarb18b4962022-09-02 21:55:50 +0100869 call assert_equal('Xtabfile', @%)
Bram Moolenaar5d3c9f82020-06-26 20:41:39 +0200870 augroup T2
871 au!
872 augroup END
873 augroup! T2
874 %bw!
875endfunc
876
Bram Moolenaar62a23252020-08-09 14:04:42 +0200877" Test for jumping to last accessed tabpage
878func Test_lastused_tabpage()
879 tabonly!
880 call assert_equal(0, tabpagenr('#'))
881 call assert_beeps('call feedkeys("g\<Tab>", "xt")')
882 call assert_beeps('call feedkeys("\<C-Tab>", "xt")')
883 call assert_beeps('call feedkeys("\<C-W>g\<Tab>", "xt")')
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200884 call assert_fails('tabnext #', 'E475:')
Bram Moolenaar62a23252020-08-09 14:04:42 +0200885
886 " open four tab pages
887 tabnew
888 tabnew
889 tabnew
890
891 2tabnext
892
893 " Test for g<Tab>
894 call assert_equal(4, tabpagenr('#'))
895 call feedkeys("g\<Tab>", "xt")
896 call assert_equal(4, tabpagenr())
897 call assert_equal(2, tabpagenr('#'))
898
899 " Test for <C-Tab>
900 call feedkeys("\<C-Tab>", "xt")
901 call assert_equal(2, tabpagenr())
902 call assert_equal(4, tabpagenr('#'))
903
904 " Test for <C-W>g<Tab>
905 call feedkeys("\<C-W>g\<Tab>", "xt")
906 call assert_equal(4, tabpagenr())
907 call assert_equal(2, tabpagenr('#'))
908
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200909 " Test for :tabnext #
910 tabnext #
911 call assert_equal(2, tabpagenr())
912 call assert_equal(4, tabpagenr('#'))
913
Bram Moolenaar62a23252020-08-09 14:04:42 +0200914 " Try to jump to a closed tab page
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200915 tabclose #
Bram Moolenaar62a23252020-08-09 14:04:42 +0200916 call assert_equal(0, tabpagenr('#'))
917 call feedkeys("g\<Tab>", "xt")
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200918 call assert_equal(2, tabpagenr())
Bram Moolenaar62a23252020-08-09 14:04:42 +0200919 call feedkeys("\<C-Tab>", "xt")
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200920 call assert_equal(2, tabpagenr())
Bram Moolenaar62a23252020-08-09 14:04:42 +0200921 call feedkeys("\<C-W>g\<Tab>", "xt")
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200922 call assert_equal(2, tabpagenr())
923 call assert_fails('tabnext #', 'E475:')
924 call assert_equal(2, tabpagenr())
Bram Moolenaar62a23252020-08-09 14:04:42 +0200925
Bram Moolenaar94f4ffa2020-08-10 19:21:15 +0200926 " Test for :tabonly #
927 let wnum = win_getid()
928 $tabnew
929 tabonly #
930 call assert_equal(wnum, win_getid())
931 call assert_equal(1, tabpagenr('$'))
932
933 " Test for :tabmove #
934 tabnew
935 let wnum = win_getid()
936 tabnew
937 tabnew
938 tabnext 2
939 tabmove #
940 call assert_equal(4, tabpagenr())
941 call assert_equal(wnum, win_getid())
942
943 tabonly!
Bram Moolenaar62a23252020-08-09 14:04:42 +0200944endfunc
945
Yegappan Lakshmanan72bb47e2022-04-03 11:22:38 +0100946" Test for tabpage allocation failure
947func Test_tabpage_alloc_failure()
948 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
949 call assert_fails('tabnew', 'E342:')
950
951 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
952 edit Xfile1
953 call assert_fails('tabedit Xfile2', 'E342:')
954 call assert_equal(1, winnr('$'))
955 call assert_equal(1, tabpagenr('$'))
956 call assert_equal('Xfile1', @%)
957
958 new
959 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
960 call assert_fails('wincmd T', 'E342:')
961 bw!
962
963 call test_alloc_fail(GetAllocId('newtabpage_tvars'), 0, 0)
964 call assert_fails('tab split', 'E342:')
965 call assert_equal(2, winnr('$'))
966 call assert_equal(1, tabpagenr('$'))
967endfunc
968
LemonBoy5247b0b2024-07-12 19:30:58 +0200969func Test_tabpage_tabclose()
970 " Default behaviour, move to the right.
971 call s:reconstruct_tabpage_for_test(6)
972 norm! 4gt
973 setl tcl=
974 tabclose
975 call assert_equal("n3", bufname())
976
977 " Move to the left.
978 call s:reconstruct_tabpage_for_test(6)
979 norm! 4gt
980 setl tcl=left
981 tabclose
982 call assert_equal("n1", bufname())
983
984 " Move to the last used tab page.
985 call s:reconstruct_tabpage_for_test(6)
986 norm! 5gt
987 norm! 2gt
988 setl tcl=uselast
989 tabclose
990 call assert_equal("n3", bufname())
991
992 " Same, but the last used tab page is invalid. Move to the right.
993 call s:reconstruct_tabpage_for_test(6)
994 norm! 5gt
995 norm! 3gt
996 setl tcl=uselast
997 tabclose 5
998 tabclose!
999 call assert_equal("n2", bufname())
1000
1001 " Same, but the last used tab page is invalid. Move to the left.
1002 call s:reconstruct_tabpage_for_test(6)
1003 norm! 5gt
1004 norm! 3gt
1005 setl tcl=uselast,left
1006 tabclose 5
1007 tabclose!
1008 call assert_equal("n0", bufname())
1009
1010 " Move left when moving right is not possible.
1011 call s:reconstruct_tabpage_for_test(6)
1012 setl tcl=
1013 norm! 6gt
1014 tabclose
1015 call assert_equal("n3", bufname())
1016
1017 " Move right when moving left is not possible.
1018 call s:reconstruct_tabpage_for_test(6)
1019 setl tcl=left
1020 norm! 1gt
1021 tabclose
1022 call assert_equal("n0", bufname())
1023
1024 setl tcl&
1025endfunc
1026
Bram Moolenaar99ad3a82023-02-27 17:18:01 +00001027" this was giving ml_get errors
1028func Test_tabpage_last_line()
1029 enew
1030 call setline(1, repeat(['a'], &lines + 5))
1031 $
1032 tabnew
1033 call setline(1, repeat(['b'], &lines + 20))
1034 $
1035 tabNext
1036 call assert_equal('a', getline('.'))
1037
1038 bwipe!
1039 bwipe!
1040endfunc
1041
Christian Brabandtdf12e392023-12-16 13:55:32 +01001042" this was causing an endless loop
1043func Test_tabpage_drop_tabmove()
1044 augroup TestTabpageTabmove
1045 au!
1046 autocmd! TabEnter * :if tabpagenr() > 1 | tabmove - | endif
1047 augroup end
1048 $tab drop XTab_99.log
1049 $tab drop XTab_98.log
1050 $tab drop XTab_97.log
1051
1052 autocmd! TestTabpageTabmove
1053 augroup! TestTabpageTabmove
1054
1055 " clean up
1056 bwipe!
1057 bwipe!
1058 bwipe!
1059endfunc
1060
zeertzjqb47fbb42024-02-12 22:50:26 +01001061" Test that settabvar() shouldn't change the last accessed tabpage.
1062func Test_lastused_tabpage_settabvar()
1063 tabonly!
1064 tabnew
1065 tabnew
1066 tabnew
1067 call assert_equal(3, tabpagenr('#'))
1068
1069 call settabvar(2, 'myvar', 'tabval')
1070 call assert_equal('tabval', gettabvar(2, 'myvar'))
1071 call assert_equal(3, tabpagenr('#'))
1072
1073 bwipe!
1074 bwipe!
1075 bwipe!
1076endfunc
1077
Bram Moolenaar1381d792016-08-18 22:11:42 +02001078" vim: shiftwidth=2 sts=2 expandtab