annotate src/testdir/test_bufwintabinfo.vim @ 18463:18d7337b6837 v8.1.2225

patch 8.1.2225: the "last used" info of a buffer is under used Commit: https://github.com/vim/vim/commit/52410575be50d5c40bbe6380159df48cfc382ceb Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 27 05:12:45 2019 +0100 patch 8.1.2225: the "last used" info of a buffer is under used Problem: The "last used" info of a buffer is under used. Solution: Add "lastused" to getbufinfo(). List buffers sorted by last-used field. (Andi Massimino, closes #4722)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Oct 2019 05:15:06 +0100
parents 7a19c8d6bb9e
children 068337e86133
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
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 function Test_getbufwintabinfo()
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 edit Xtestfile1
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 edit Xtestfile2
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 let buflist = getbufinfo()
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call assert_equal(2, len(buflist))
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_match('Xtestfile1', buflist[0].name)
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_match('Xtestfile2', getbufinfo('Xtestfile2')[0].name)
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call assert_equal([], getbufinfo(2016))
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 edit Xtestfile1
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 hide edit Xtestfile2
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 hide enew
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal(3, len(getbufinfo({'bufloaded':1})))
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
16 set tabstop&vim
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
17 let b:editor = 'vim'
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
18 let l = getbufinfo('%')
9904
24900147aa44 commit https://github.com/vim/vim/commit/339288377072f66ec88e21903e75a82d23ffbf4f
Christian Brabandt <cb@256bit.org>
parents: 9883
diff changeset
19 call assert_equal(bufnr('%'), l[0].bufnr)
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
20 call assert_equal('vim', l[0].variables.editor)
17825
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14343
diff changeset
21 call assert_notequal(-1, index(l[0].windows, '%'->bufwinid()))
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
22
13020
58cce40c965b patch 8.0.1386: cannot select modified buffers with getbufinfo()
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
23 " Test for getbufinfo() with 'bufmodified'
58cce40c965b patch 8.0.1386: cannot select modified buffers with getbufinfo()
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
24 call assert_equal(0, len(getbufinfo({'bufmodified' : 1})))
58cce40c965b patch 8.0.1386: cannot select modified buffers with getbufinfo()
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
25 call setbufline('Xtestfile1', 1, ["Line1"])
58cce40c965b patch 8.0.1386: cannot select modified buffers with getbufinfo()
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
26 let l = getbufinfo({'bufmodified' : 1})
58cce40c965b patch 8.0.1386: cannot select modified buffers with getbufinfo()
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
27 call assert_equal(1, len(l))
58cce40c965b patch 8.0.1386: cannot select modified buffers with getbufinfo()
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
28 call assert_equal(bufnr('Xtestfile1'), l[0].bufnr)
58cce40c965b patch 8.0.1386: cannot select modified buffers with getbufinfo()
Christian Brabandt <cb@256bit.org>
parents: 12692
diff changeset
29
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
30 if has('signs')
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
31 call append(0, ['Linux', 'Windows', 'Mac'])
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
32 sign define Mark text=>> texthl=Search
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
33 exe "sign place 2 line=3 name=Mark buffer=" . bufnr('%')
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
34 let l = getbufinfo('%')
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
35 call assert_equal(2, l[0].signs[0].id)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
36 call assert_equal(3, l[0].signs[0].lnum)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
37 call assert_equal('Mark', l[0].signs[0].name)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
38 sign unplace *
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
39 sign undefine Mark
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
40 enew!
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
41 endif
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
42
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 only
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 let w1_id = win_getid()
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 new
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 let w2_id = win_getid()
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 tabnew | let w3_id = win_getid()
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 new | let w4_id = win_getid()
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
49 vert new | let w5_id = win_getid()
18000
7a19c8d6bb9e patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17912
diff changeset
50 eval 'green'->setwinvar(0, 'signal')
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 tabfirst
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 let winlist = getwininfo()
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal(5, len(winlist))
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
54 call assert_equal(winwidth(1), winlist[0].width)
14343
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
55 call assert_equal(1, winlist[0].wincol)
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
56 " tabline adds one row in terminal, not in GUI
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
57 let tablineheight = winlist[0].winrow == 2 ? 1 : 0
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
58 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
59
9904
24900147aa44 commit https://github.com/vim/vim/commit/339288377072f66ec88e21903e75a82d23ffbf4f
Christian Brabandt <cb@256bit.org>
parents: 9883
diff changeset
60 call assert_equal(winbufnr(2), winlist[1].bufnr)
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
61 call assert_equal(winheight(2), winlist[1].height)
14343
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
62 call assert_equal(1, winlist[1].wincol)
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
63 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
64
9904
24900147aa44 commit https://github.com/vim/vim/commit/339288377072f66ec88e21903e75a82d23ffbf4f
Christian Brabandt <cb@256bit.org>
parents: 9883
diff changeset
65 call assert_equal(1, winlist[2].winnr)
14343
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
66 call assert_equal(tablineheight + 1, winlist[2].winrow)
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
67 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
68
14343
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
69 call assert_equal(winlist[2].width + 2, winlist[3].wincol)
7589f103ec11 patch 8.1.0187: getwininfo() and win_screenpos() return different numbers
Christian Brabandt <cb@256bit.org>
parents: 14341
diff changeset
70 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
71
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
72 call assert_equal(1, winlist[0].tabnr)
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
73 call assert_equal(1, winlist[1].tabnr)
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
74 call assert_equal(2, winlist[2].tabnr)
9904
24900147aa44 commit https://github.com/vim/vim/commit/339288377072f66ec88e21903e75a82d23ffbf4f
Christian Brabandt <cb@256bit.org>
parents: 9883
diff changeset
75 call assert_equal(2, winlist[3].tabnr)
14337
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
76 call assert_equal(2, winlist[4].tabnr)
48287f1fc8a1 patch 8.1.0184: not easy to figure out the window layout
Christian Brabandt <cb@256bit.org>
parents: 13020
diff changeset
77
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
78 call assert_equal('green', winlist[2].variables.signal)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
79 call assert_equal(w4_id, winlist[3].winid)
17912
9fac6d0de69a patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17857
diff changeset
80 let winfo = w5_id->getwininfo()[0]
9904
24900147aa44 commit https://github.com/vim/vim/commit/339288377072f66ec88e21903e75a82d23ffbf4f
Christian Brabandt <cb@256bit.org>
parents: 9883
diff changeset
81 call assert_equal(2, winfo.tabnr)
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal([], getwininfo(3))
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
84 call settabvar(1, 'space', 'build')
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 let tablist = gettabinfo()
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal(2, len(tablist))
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(3, len(tablist[1].windows))
9904
24900147aa44 commit https://github.com/vim/vim/commit/339288377072f66ec88e21903e75a82d23ffbf4f
Christian Brabandt <cb@256bit.org>
parents: 9883
diff changeset
88 call assert_equal(2, tablist[1].tabnr)
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
89 call assert_equal('build', tablist[0].variables.space)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
90 call assert_equal(w2_id, tablist[0].windows[0])
17857
4935244c1128 patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17825
diff changeset
91 call assert_equal([], 3->gettabinfo())
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 tabonly | only
9881
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
94
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
95 lexpr ''
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
96 lopen
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
97 copen
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
98 let winlist = getwininfo()
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
99 call assert_false(winlist[0].quickfix)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
100 call assert_false(winlist[0].loclist)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
101 call assert_true(winlist[1].quickfix)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
102 call assert_true(winlist[1].loclist)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
103 call assert_true(winlist[2].quickfix)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
104 call assert_false(winlist[2].loclist)
4b53f6be10c0 commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788
Christian Brabandt <cb@256bit.org>
parents: 9858
diff changeset
105 wincmd t | only
9858
3e96d9ed2ca1 commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 endfunction
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
107
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
108 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
109 let opts = bufnr()->getbufvar('&')
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
110 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
111 call assert_equal(8, opts.tabstop)
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
112 endfunc
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
113
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
114 function Test_get_win_options()
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
115 if has('folding')
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
116 set foldlevel=999
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
117 endif
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
118 set list
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
119 let opts = getwinvar(1, '&')
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(0, opts.linebreak)
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
122 call assert_equal(1, opts.list)
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
123 if has('folding')
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
124 call assert_equal(999, opts.foldlevel)
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
125 endif
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
126 if has('signs')
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
127 call assert_equal('auto', opts.signcolumn)
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
128 endif
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
129
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
130 let opts = gettabwinvar(1, 1, '&')
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
131 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
132 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
133 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
134 if has('signs')
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
135 call assert_equal('auto', opts.signcolumn)
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
136 endif
10205
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
137 set list&
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
138 if has('folding')
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
139 set foldlevel=0
22e97a250277 commit https://github.com/vim/vim/commit/789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35
Christian Brabandt <cb@256bit.org>
parents: 10000
diff changeset
140 endif
10000
233289599874 commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Christian Brabandt <cb@256bit.org>
parents: 9904
diff changeset
141 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
142
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150 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
151 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
152 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
153 endfunc