1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
-- Tests for :[count]close! and :[count]hide
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local poke_eventloop = helpers.poke_eventloop
local eval = helpers.eval
local feed = helpers.feed
local clear = helpers.clear
local command = helpers.command
describe('close_count', function()
setup(clear)
it('is working', function()
command('let tests = []')
command('for i in range(5)|new|endfor')
command('4wincmd w')
command('close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({6, 5, 4, 2, 1}, eval('buffers'))
command('1close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({5, 4, 2, 1}, eval('buffers'))
command('$close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({5, 4, 2}, eval('buffers'))
command('1wincmd w')
command('2close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({5, 2}, eval('buffers'))
command('1wincmd w')
command('new')
command('new')
command('2wincmd w')
command('-1close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({7, 5, 2}, eval('buffers'))
command('2wincmd w')
command('+1close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({7, 5}, eval('buffers'))
command('only!')
command('b1')
command('let tests = []')
command('for i in range(5)|new|endfor')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({13, 12, 11, 10, 9, 1}, eval('buffers'))
command('4wincmd w')
command('.hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({13, 12, 11, 9, 1}, eval('buffers'))
command('1hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({12, 11, 9, 1}, eval('buffers'))
command('$hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({12, 11, 9}, eval('buffers'))
command('1wincmd w')
command('2hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({12, 9}, eval('buffers'))
command('1wincmd w')
command('new')
command('new')
command('3wincmd w')
command('-hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({15, 12, 9}, eval('buffers'))
command('2wincmd w')
command('+hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({15, 12}, eval('buffers'))
command('only!')
command('b1')
command('let tests = []')
command('set hidden')
command('for i in range(5)|new|endfor')
command('1wincmd w')
command('$ hide')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({20, 19, 18, 17, 16}, eval('buffers'))
command('$-1 close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({20, 19, 18, 16}, eval('buffers'))
command('1wincmd w')
command('.+close!')
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({20, 18, 16}, eval('buffers'))
command('only!')
command('b1')
command('let tests = []')
command('set hidden')
command('for i in range(5)|new|endfor')
command('4wincmd w')
feed('<C-W>c<cr>')
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({25, 24, 23, 21, 1}, eval('buffers'))
feed('1<C-W>c<cr>')
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21, 1}, eval('buffers'))
feed('9<C-W>c<cr>')
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21}, eval('buffers'))
command('1wincmd w')
feed('2<C-W>c<cr>')
poke_eventloop()
command('let buffers = []')
command('windo call add(buffers, bufnr("%"))')
eq({24, 21}, eval('buffers'))
end)
end)
|