2015-06-11 03:33:08 -07:00
|
|
|
-- Tests for :[count]close! and :[count]hide
|
|
|
|
|
2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2017-04-08 14:12:26 -07:00
|
|
|
|
|
|
|
local eq = helpers.eq
|
|
|
|
local wait = helpers.wait
|
|
|
|
local feed = helpers.feed
|
|
|
|
local clear = helpers.clear
|
|
|
|
local command = helpers.command
|
2015-06-11 03:33:08 -07:00
|
|
|
|
|
|
|
describe('close_count', function()
|
2015-06-11 03:55:31 -07:00
|
|
|
setup(clear)
|
2015-06-11 03:33:08 -07:00
|
|
|
|
|
|
|
it('is working', function()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('let tests = []')
|
|
|
|
command('for i in range(5)')
|
|
|
|
command('new')
|
|
|
|
command('endfor')
|
|
|
|
command('4wincmd w')
|
|
|
|
command('close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({6, 5, 4, 2, 1}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({5, 4, 2, 1}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('$close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({5, 4, 2}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1wincmd w')
|
|
|
|
command('2close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({5, 2}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1wincmd w')
|
|
|
|
command('new')
|
|
|
|
command('new')
|
|
|
|
command('2wincmd w')
|
|
|
|
command('-1close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({7, 5, 2}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('2wincmd w')
|
|
|
|
command('+1close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({7, 5}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('only!')
|
|
|
|
command('b1')
|
|
|
|
command('let tests = []')
|
|
|
|
command('for i in range(5)')
|
|
|
|
command('new')
|
|
|
|
command('endfor')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({13, 12, 11, 10, 9, 1}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('4wincmd w')
|
|
|
|
command('.hide')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({13, 12, 11, 9, 1}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1hide')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({12, 11, 9, 1}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('$hide')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({12, 11, 9}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1wincmd w')
|
|
|
|
command('2hide')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({12, 9}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1wincmd w')
|
|
|
|
command('new')
|
|
|
|
command('new')
|
|
|
|
command('3wincmd w')
|
|
|
|
command('-hide')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({15, 12, 9}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('2wincmd w')
|
|
|
|
command('+hide')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({15, 12}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('only!')
|
|
|
|
command('b1')
|
|
|
|
command('let tests = []')
|
|
|
|
command('set hidden')
|
|
|
|
command('for i in range(5)')
|
|
|
|
command('new')
|
|
|
|
command('endfor')
|
|
|
|
command('1wincmd w')
|
|
|
|
command('$ hide')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({20, 19, 18, 17, 16}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('$-1 close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({20, 19, 18, 16}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1wincmd w')
|
|
|
|
command('.+close!')
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({20, 18, 16}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('only!')
|
|
|
|
command('b1')
|
|
|
|
command('let tests = []')
|
|
|
|
command('set hidden')
|
|
|
|
command('for i in range(5)')
|
|
|
|
command('new')
|
|
|
|
command('endfor')
|
|
|
|
command('4wincmd w')
|
2015-06-11 03:33:08 -07:00
|
|
|
feed('<C-W>c<cr>')
|
2017-04-08 14:12:26 -07:00
|
|
|
wait()
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({25, 24, 23, 21, 1}, eval('buffers'))
|
2015-06-11 03:33:08 -07:00
|
|
|
feed('1<C-W>c<cr>')
|
2017-04-08 14:12:26 -07:00
|
|
|
wait()
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({24, 23, 21, 1}, eval('buffers'))
|
2015-06-11 03:33:08 -07:00
|
|
|
feed('9<C-W>c<cr>')
|
2017-04-08 14:12:26 -07:00
|
|
|
wait()
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({24, 23, 21}, eval('buffers'))
|
2017-04-08 14:12:26 -07:00
|
|
|
command('1wincmd w')
|
2015-06-11 03:33:08 -07:00
|
|
|
feed('2<C-W>c<cr>')
|
2017-04-08 14:12:26 -07:00
|
|
|
wait()
|
|
|
|
command('let buffers = []')
|
|
|
|
command('windo call add(buffers, bufnr("%"))')
|
2015-06-11 03:55:31 -07:00
|
|
|
eq({24, 21}, eval('buffers'))
|
2015-06-11 03:33:08 -07:00
|
|
|
end)
|
|
|
|
end)
|