neovim/test/functional/legacy/054_buffer_local_autocommands_spec.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
907 B
Lua
Raw Normal View History

2014-10-24 14:16:18 -07:00
-- Some tests for buffer-local autocommands
local t = require('test.functional.testutil')()
local clear = t.clear
local expect = t.expect
local command = t.command
local fname = 'Xtest-functional-legacy-054'
2014-10-24 14:16:18 -07:00
describe('BufLeave <buffer>', function()
setup(clear)
it('is working', function()
command('write! ' .. fname)
command('autocmd BufLeave <buffer> normal! Ibuffer-local autocommand')
command('autocmd BufLeave <buffer> update')
2014-10-24 14:16:18 -07:00
-- Here, autocommand for xx shall append a line
-- But autocommand shall not apply to buffer named <buffer>
command('edit somefile')
2014-10-24 14:16:18 -07:00
-- Here, autocommand shall be auto-deleted
command('bwipeout ' .. fname)
2014-10-24 14:16:18 -07:00
-- Nothing shall be written
command('edit ' .. fname)
command('edit somefile')
command('edit ' .. fname)
2014-10-24 14:16:18 -07:00
expect('buffer-local autocommand')
2014-10-24 14:16:18 -07:00
end)
teardown(function()
os.remove(fname)
2014-10-24 14:16:18 -07:00
end)
end)