blob: 236ca30f99bae81d7b85dd02b9cb6789b61e3c63 [file] [log] [blame]
Bram Moolenaarb5ae48e2016-08-12 22:23:25 +02001" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
2
3function 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
38endfunction