annotate src/testdir/test_window_id.vim @ 19894:ea4f8e789627 v8.2.0503

patch 8.2.0503: Vim9: some code is not tested Commit: https://github.com/vim/vim/commit/585fea7b98b79f2c6d92fa8a2340e461aff805c8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 2 22:33:21 2020 +0200 patch 8.2.0503: Vim9: some code is not tested Problem: Vim9: some code is not tested. Solution: Add tests. Fix uncovered problems.
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Apr 2020 22:45:04 +0200
parents 068337e86133
children 2fb397573541
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test using the window ID.
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
2 source check.vim
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 func Test_win_getid()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 edit one
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 let id1 = win_getid()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
7 let w:one = 'one'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 split two
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 let id2 = win_getid()
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
10 let bufnr2 = bufnr('%')
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
11 let w:two = 'two'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 split three
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 let id3 = win_getid()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
14 let w:three = 'three'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 tabnew
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 edit four
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 let id4 = win_getid()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
18 let w:four = 'four'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 split five
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 let id5 = win_getid()
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
21 let bufnr5 = bufnr('%')
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
22 let w:five = 'five'
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal("two", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(id2, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let nr2 = winnr()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal("one", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal(id1, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let nr1 = winnr()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal("three", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal(id3, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 let nr3 = winnr()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
37 call assert_equal('one', getwinvar(id1, 'one'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
38 call assert_equal('two', getwinvar(id2, 'two'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
39 call assert_equal('three', getwinvar(id3, 'three'))
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal("five", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal(id5, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 let nr5 = winnr()
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 wincmd w
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal("four", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal(id4, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 let nr4 = winnr()
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
48 call assert_equal('four', getwinvar(id4, 'four'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
49 call assert_equal('five', getwinvar(id5, 'five'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
50 call settabwinvar(1, id2, 'two', '2')
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
51 call setwinvar(id4, 'four', '4')
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 tabnext
9223
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
53 call assert_equal('4', gettabwinvar(2, id4, 'four'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
54 call assert_equal('five', gettabwinvar(2, id5, 'five'))
6c4d610fce0a commit https://github.com/vim/vim/commit/888ccac8902cee186fbd47e971881f6d9b19c068
Christian Brabandt <cb@256bit.org>
parents: 8536
diff changeset
55 call assert_equal('2', getwinvar(id2, 'two'))
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 exe nr1 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 call assert_equal(id1, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 exe nr2 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call assert_equal(id2, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 exe nr3 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call assert_equal(id3, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 exe nr4 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 call assert_equal(id4, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 exe nr5 . "wincmd w"
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 call assert_equal(id5, win_getid())
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call win_gotoid(id2)
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call assert_equal("two", expand("%"))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
71 eval id4->win_gotoid()
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_equal("four", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call win_gotoid(id1)
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal("one", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call win_gotoid(id5)
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call assert_equal("five", expand("%"))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal(0, win_id2win(9999))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
79 call assert_equal(nr5, id5->win_id2win())
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call assert_equal(0, win_id2win(id1))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 tabnext
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal(nr1, win_id2win(id1))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call assert_equal([0, 0], win_id2tabwin(9999))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
85 call assert_equal([1, nr2], id2->win_id2tabwin())
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal([2, nr4], win_id2tabwin(id4))
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
88 call assert_equal([], win_findbuf(9999))
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
89 call assert_equal([id2], bufnr2->win_findbuf())
8536
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
90 call win_gotoid(id5)
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
91 split
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
92 call assert_equal(sort([id5, win_getid()]), sort(win_findbuf(bufnr5)))
09041d2fd7d0 commit https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Christian Brabandt <cb@256bit.org>
parents: 8534
diff changeset
93
8534
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 only!
485d4d8a97f6 commit https://github.com/vim/vim/commit/86edef664efccbfe685906c854b9cdd04e56f2d5
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 endfunc
10377
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
96
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
97 func Test_win_getid_curtab()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
98 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18035
diff changeset
99
10377
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
100 tabedit X
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
101 tabfirst
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
102 copen
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
103 only
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
104 call assert_equal(win_getid(1), 1->win_getid( 1))
10377
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
105 tabclose!
dd397210a2d3 commit https://github.com/vim/vim/commit/8e639052638a9bb8c7dd6e3e10776b1218cec1a3
Christian Brabandt <cb@256bit.org>
parents: 9223
diff changeset
106 endfunc
14587
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
107
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
108 func Test_winlayout()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
109 let w1 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
110 call assert_equal(['leaf', w1], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
111
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
112 split
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
113 let w2 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
114 call assert_equal(['col', [['leaf', w2], ['leaf', w1]]], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
115
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
116 split
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
117 let w3 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
118 call assert_equal(['col', [['leaf', w3], ['leaf', w2], ['leaf', w1]]], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
119
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
120 2wincmd w
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
121 vsplit
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
122 let w4 = win_getid()
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
123 call assert_equal(['col', [['leaf', w3], ['row', [['leaf', w4], ['leaf', w2]]], ['leaf', w1]]], winlayout())
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
124
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
125 only!
18035
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
126
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
127 let w1 = win_getid()
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
128 call assert_equal(['leaf', w1], winlayout(1))
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
129 tabnew
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
130 let w2 = win_getid()
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
131 call assert_equal(['leaf', w2], 2->winlayout())
11dca9732a48 patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 14587
diff changeset
132 tabclose
14587
d33220d3bc27 patch 8.1.0307: there is no good way to get the window layout
Christian Brabandt <cb@256bit.org>
parents: 10377
diff changeset
133 endfunc