mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 21:55:17 -07:00
07db909eb5
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
42 lines
1.0 KiB
Lua
42 lines
1.0 KiB
Lua
local t = require('test.testutil')
|
|
local n = require('test.functional.testnvim')()
|
|
|
|
local clear = n.clear
|
|
local command = n.command
|
|
local call = n.call
|
|
local feed = n.feed
|
|
local eval = n.eval
|
|
local eq = t.eq
|
|
|
|
describe('CompleteDone', function()
|
|
before_each(clear)
|
|
|
|
describe('sets v:event.reason', function()
|
|
before_each(function()
|
|
clear()
|
|
command('autocmd CompleteDone * let g:donereason = v:event.reason')
|
|
feed('i')
|
|
call('complete', call('col', '.'), { 'foo', 'bar' })
|
|
end)
|
|
|
|
it('accept', function()
|
|
feed('<C-y>')
|
|
eq('accept', eval('g:donereason'))
|
|
end)
|
|
describe('cancel', function()
|
|
it('on <C-e>', function()
|
|
feed('<C-e>')
|
|
eq('cancel', eval('g:donereason'))
|
|
end)
|
|
it('on non-keyword character', function()
|
|
feed('<Esc>')
|
|
eq('cancel', eval('g:donereason'))
|
|
end)
|
|
it('when overridden by another complete()', function()
|
|
call('complete', call('col', '.'), { 'bar', 'baz' })
|
|
eq('cancel', eval('g:donereason'))
|
|
end)
|
|
end)
|
|
end)
|
|
end)
|