2015-11-15 07:45:23 -07:00
|
|
|
local helpers = require('test.functional.helpers')
|
|
|
|
local Screen = require('test.functional.ui.screen')
|
|
|
|
|
2015-11-17 15:31:22 -07:00
|
|
|
local clear, execute, feed, nvim, nvim_dir = helpers.clear,
|
2015-11-15 07:45:23 -07:00
|
|
|
helpers.execute, helpers.feed, helpers.nvim, helpers.nvim_dir
|
2016-02-19 19:51:50 -07:00
|
|
|
local eval, eq = helpers.eval, helpers.eq
|
2015-11-15 07:45:23 -07:00
|
|
|
|
|
|
|
describe('TermClose event', function()
|
2015-11-17 15:31:22 -07:00
|
|
|
local screen
|
2015-11-15 07:45:23 -07:00
|
|
|
before_each(function()
|
|
|
|
clear()
|
|
|
|
nvim('set_option', 'shell', nvim_dir .. '/shell-test')
|
|
|
|
nvim('set_option', 'shellcmdflag', 'EXE')
|
|
|
|
screen = Screen.new(20, 4)
|
|
|
|
screen:attach(false)
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('works as expected', function()
|
|
|
|
execute('autocmd TermClose * echomsg "TermClose works!"')
|
|
|
|
execute('terminal')
|
|
|
|
feed('<c-\\><c-n>')
|
|
|
|
screen:expect([[
|
|
|
|
ready $ |
|
|
|
|
[Process exited 0] |
|
|
|
|
^ |
|
|
|
|
TermClose works! |
|
|
|
|
]])
|
|
|
|
end)
|
2016-02-19 19:51:50 -07:00
|
|
|
|
|
|
|
it('reports the correct <abuf>', function()
|
|
|
|
execute('set hidden')
|
|
|
|
execute('autocmd TermClose * let g:abuf = expand("<abuf>")')
|
|
|
|
execute('edit foo')
|
|
|
|
execute('edit bar')
|
|
|
|
eq(2, eval('bufnr("%")'))
|
|
|
|
execute('terminal')
|
|
|
|
feed('<c-\\><c-n>')
|
|
|
|
eq(3, eval('bufnr("%")'))
|
|
|
|
execute('buffer 1')
|
|
|
|
eq(1, eval('bufnr("%")'))
|
|
|
|
execute('3bdelete!')
|
|
|
|
eq('3', eval('g:abuf'))
|
|
|
|
end)
|
2015-11-15 07:45:23 -07:00
|
|
|
end)
|