comparison src/testdir/test_bufwintabinfo.vim @ 9858:3e96d9ed2ca1 v7.4.2204

commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 12 22:23:25 2016 +0200 patch 7.4.2204 Problem: It is not easy to get information about buffers, windows and tabpages. Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Fri, 12 Aug 2016 22:30:07 +0200
parents
children 4b53f6be10c0
comparison
equal deleted inserted replaced
9857:0ee54b6ef77d 9858:3e96d9ed2ca1
1 " Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
2
3 function Test_getbufwintabinfo()
4 1,$bwipeout
5 edit Xtestfile1
6 edit Xtestfile2
7 let buflist = getbufinfo()
8 call assert_equal(2, len(buflist))
9 call assert_match('Xtestfile1', buflist[0].name)
10 call assert_match('Xtestfile2', getbufinfo('Xtestfile2')[0].name)
11 call assert_equal([], getbufinfo(2016))
12 edit Xtestfile1
13 hide edit Xtestfile2
14 hide enew
15 call assert_equal(3, len(getbufinfo({'bufloaded':1})))
16
17 only
18 let w1_id = win_getid()
19 new
20 let w2_id = win_getid()
21 tabnew | let w3_id = win_getid()
22 new | let w4_id = win_getid()
23 new | let w5_id = win_getid()
24 tabfirst
25 let winlist = getwininfo()
26 call assert_equal(5, len(winlist))
27 call assert_equal(2, winlist[3].tpnr)
28 let winfo = getwininfo(w5_id)[0]
29 call assert_equal(2, winfo.tpnr)
30 call assert_equal([], getwininfo(3))
31
32 let tablist = gettabinfo()
33 call assert_equal(2, len(tablist))
34 call assert_equal(3, len(tablist[1].windows))
35 call assert_equal([], gettabinfo(3))
36
37 tabonly | only
38 endfunction