annotate src/testdir/test_bufwintabinfo.vim @ 29565:54893d648fd5

Added tag v9.0.0123 for changeset 7234ae4e015806f8994fe858b5e438b64f09db81
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 Jul 2022 19:15:05 +0200
parents 65ff2409cba4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21381
diff changeset
2
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
3 source check.vim
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
4
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
5 func Test_getbufwintabinfo()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
6 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
7
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
8 edit Xtestfile1
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
9 edit Xtestfile2
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
10 let buflist = getbufinfo()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
11 call assert_equal(2, len(buflist))
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
12 call assert_match('Xtestfile1', buflist[0].name)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
13 call assert_match('Xtestfile2', getbufinfo('Xtestfile2')[0].name)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
14 call assert_equal([], getbufinfo(2016))
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
15 edit Xtestfile1
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
16 hide edit Xtestfile2
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
17 hide enew
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
18 call assert_equal(3, len(getbufinfo({'bufloaded':1})))
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
20 set tabstop&vim
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
21 let b:editor = 'vim'
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
22 let l = getbufinfo('%')
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
23 call assert_equal(bufnr('%'), l[0].bufnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
24 call assert_equal('vim', l[0].variables.editor)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
25 call assert_notequal(-1, index(l[0].windows, '%'->bufwinid()))
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
21381
95e6fb6a5c86 patch 8.2.1241: cannot use getbufinfo() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
27 let l = '%'->getbufinfo()
95e6fb6a5c86 patch 8.2.1241: cannot use getbufinfo() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
28 call assert_equal(bufnr('%'), l[0].bufnr)
95e6fb6a5c86 patch 8.2.1241: cannot use getbufinfo() as a method
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
29
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
30 " Test for getbufinfo() with 'bufmodified'
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
31 call assert_equal(0, len(getbufinfo({'bufmodified' : 1})))
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
32 call setbufline('Xtestfile1', 1, ["Line1"])
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
33 let l = getbufinfo({'bufmodified' : 1})
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
34 call assert_equal(1, len(l))
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
35 call assert_equal(bufnr('Xtestfile1'), l[0].bufnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
36
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
37 if has('signs')
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
38 call append(0, ['Linux', 'Windows', 'Mac'])
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
39 sign define Mark text=>> texthl=Search
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
40 exe "sign place 2 line=3 name=Mark buffer=" . bufnr('%')
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
41 let l = getbufinfo('%')
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
42 call assert_equal(2, l[0].signs[0].id)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
43 call assert_equal(3, l[0].signs[0].lnum)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
44 call assert_equal('Mark', l[0].signs[0].name)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
45 sign unplace *
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
46 sign undefine Mark
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
47 enew!
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
48 endif
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 18916
diff changeset
49 call assert_notequal([], getbufinfo(test_null_dict()))
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
50
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
51 only
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
52 let w1_id = win_getid()
26191
72c394673e00 patch 8.2.3627: difficult to know where the text starts in a window
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
53 setl foldcolumn=3
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
54 new
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
55 let w2_id = win_getid()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
56 tabnew | let w3_id = win_getid()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
57 new | let w4_id = win_getid()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
58 vert new | let w5_id = win_getid()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
59 eval 'green'->setwinvar(0, 'signal')
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
60 tabfirst
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
61 let winlist = getwininfo()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
62 call assert_equal(5, len(winlist))
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
63 call assert_equal(winwidth(1), winlist[0].width)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
64 call assert_equal(1, winlist[0].wincol)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
65 " tabline adds one row in terminal, not in GUI
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
66 let tablineheight = winlist[0].winrow == 2 ? 1 : 0
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
67 call assert_equal(tablineheight + 1, winlist[0].winrow)
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
68
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
69 call assert_equal(winbufnr(2), winlist[1].bufnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
70 call assert_equal(winheight(2), winlist[1].height)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
71 call assert_equal(1, winlist[1].wincol)
26191
72c394673e00 patch 8.2.3627: difficult to know where the text starts in a window
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
72 call assert_equal(3, winlist[1].textoff) " foldcolumn
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
73 call assert_equal(tablineheight + winheight(1) + 2, winlist[1].winrow)
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
74
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
75 call assert_equal(1, winlist[2].winnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
76 call assert_equal(tablineheight + 1, winlist[2].winrow)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
77 call assert_equal(1, winlist[2].wincol)
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
78
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
79 call assert_equal(winlist[2].width + 2, winlist[3].wincol)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
80 call assert_equal(1, winlist[4].wincol)
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
81
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
82 call assert_equal(1, winlist[0].tabnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
83 call assert_equal(1, winlist[1].tabnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
84 call assert_equal(2, winlist[2].tabnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
85 call assert_equal(2, winlist[3].tabnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
86 call assert_equal(2, winlist[4].tabnr)
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
87
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
88 call assert_equal('green', winlist[2].variables.signal)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
89 call assert_equal(w4_id, winlist[3].winid)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
90 let winfo = w5_id->getwininfo()[0]
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
91 call assert_equal(2, winfo.tabnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
92 call assert_equal([], getwininfo(3))
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
94 call settabvar(1, 'space', 'build')
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
95 let tablist = gettabinfo()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
96 call assert_equal(2, len(tablist))
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
97 call assert_equal(3, len(tablist[1].windows))
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
98 call assert_equal(2, tablist[1].tabnr)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
99 call assert_equal('build', tablist[0].variables.space)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
100 call assert_equal(w2_id, tablist[0].windows[0])
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
101 call assert_equal([], 3->gettabinfo())
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
103 tabonly | only
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
104
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
105 lexpr ''
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
106 lopen
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
107 copen
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
108 let winlist = getwininfo()
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
109 call assert_false(winlist[0].quickfix)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
110 call assert_false(winlist[0].loclist)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
111 call assert_true(winlist[1].quickfix)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
112 call assert_true(winlist[1].loclist)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
113 call assert_true(winlist[2].quickfix)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
114 call assert_false(winlist[2].loclist)
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
115 wincmd t | only
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
116 endfunc
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
117
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
118 function Test_get_buf_options()
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17825
diff changeset
119 let opts = bufnr()->getbufvar('&')
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
120 call assert_equal(v:t_dict, type(opts))
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
121 call assert_equal(8, opts.tabstop)
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
122 endfunc
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
123
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
124 function Test_get_win_options()
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
125 if has('folding')
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
126 set foldlevel=999
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
127 endif
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
128 set list
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
129 let opts = getwinvar(1, '&')
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
130 call assert_equal(v:t_dict, type(opts))
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
131 call assert_equal(0, opts.linebreak)
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
132 call assert_equal(1, opts.list)
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
133 if has('folding')
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
134 call assert_equal(999, opts.foldlevel)
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
135 endif
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
136 if has('signs')
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
137 call assert_equal('auto', opts.signcolumn)
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
138 endif
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
139
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
140 let opts = gettabwinvar(1, 1, '&')
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
141 call assert_equal(v:t_dict, type(opts))
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
142 call assert_equal(0, opts.linebreak)
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
143 call assert_equal(1, opts.list)
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
144 if has('signs')
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
145 call assert_equal('auto', opts.signcolumn)
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
146 endif
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
147 set list&
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
148 if has('folding')
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
149 set foldlevel=0
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
150 endif
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
151 endfunc
18463
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
152
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
153 function Test_getbufinfo_lastused()
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
154 call test_settime(1234567)
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
155 edit Xtestfile1
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
156 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
157 call test_settime(7654321)
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
158 edit Xtestfile2
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
159 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
160 call assert_equal(getbufinfo('Xtestfile1')[0].lastused, 1234567)
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
161 call assert_equal(getbufinfo('Xtestfile2')[0].lastused, 7654321)
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
162 call test_settime(0)
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
163 endfunc
18916
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
164
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
165 func Test_getbufinfo_lines()
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
166 new Xfoo
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
167 call setline(1, ['a', 'bc', 'd'])
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
168 let bn = bufnr('%')
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
169 hide
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
170 call assert_equal(3, getbufinfo(bn)[0]["linecount"])
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
171 edit Xfoo
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
172 bw!
cf051bdefb3f patch 8.2.0019: cannot number of lines of another buffer
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
173 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21381
diff changeset
174
28546
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
175 func Test_getwininfo_au()
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
176 enew
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
177 call setline(1, range(1, 16))
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
178
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
179 let g:info = #{}
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
180 augroup T1
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
181 au!
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
182 au WinEnter * let g:info = getwininfo(win_getid())[0]
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
183 augroup END
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
184
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
185 4split
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
186 " Check that calling getwininfo() from WinEnter returns fresh values for
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
187 " topline and botline.
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
188 call assert_equal(1, g:info.topline)
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
189 call assert_equal(4, g:info.botline)
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
190 close
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
191
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
192 unlet g:info
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
193 augroup! T1
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
194 bwipe!
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
195 endfunc
65ff2409cba4 patch 8.2.4797: getwininfo() may get oudated values
Bram Moolenaar <Bram@vim.org>
parents: 26191
diff changeset
196
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21381
diff changeset
197 " vim: shiftwidth=2 sts=2 expandtab