aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd/termclose_spec.lua
blob: 265d857a425a5eafd88bfff8df37792816dcd213 (plain) (blame)
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
local helpers = require('test.functional.helpers')
local Screen = require('test.functional.ui.screen')

local clear, eval, execute, feed, nvim, nvim_dir = helpers.clear, helpers.eval,
helpers.execute, helpers.feed, helpers.nvim, helpers.nvim_dir
local wait = helpers.wait

describe('TermClose event', function()
  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)
end)