aboutsummaryrefslogtreecommitdiff
path: root/test/functional/viml/completion_spec.lua
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2015-06-05 22:41:22 +0900
committerScott Prager <splinterofchaos@gmail.com>2015-06-11 09:03:00 -0400
commitbe66c0b3570a55671656959203bd5b824f77fde7 (patch)
tree4d8211e86f24f084c3981edcf57a24bd91180f98 /test/functional/viml/completion_spec.lua
parent6270d431aaeed71e7a8782411f36409ab8e0ee35 (diff)
downloadrneovim-be66c0b3570a55671656959203bd5b824f77fde7.tar.gz
rneovim-be66c0b3570a55671656959203bd5b824f77fde7.tar.bz2
rneovim-be66c0b3570a55671656959203bd5b824f77fde7.zip
Add complete() noinsert/noselect support #2792
Diffstat (limited to 'test/functional/viml/completion_spec.lua')
-rw-r--r--test/functional/viml/completion_spec.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 2a02dd9cf0..7fd36c64fa 100644
--- a/test/functional/viml/completion_spec.lua
+++ b/test/functional/viml/completion_spec.lua
@@ -1,3 +1,4 @@
+
local helpers = require('test.functional.helpers')
local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq
@@ -54,25 +55,42 @@ describe('completion', function()
end)
end)
describe('completeopt', function()
+ before_each(function()
+ source([[
+ function! TestComplete() abort
+ call complete(1, ['foo'])
+ return ''
+ endfunction
+ ]])
+ end)
+
it('inserts the first candidate if default', function()
execute('set completeopt+=menuone')
feed('ifoo<ESC>o<C-x><C-n>bar<ESC>')
eq('foobar', eval('getline(2)'))
+ feed('o<C-r>=TestComplete()<CR><ESC>')
+ eq('foo', eval('getline(3)'))
end)
it('selects the first candidate if noinsert', function()
execute('set completeopt+=menuone,noinsert')
feed('ifoo<ESC>o<C-x><C-n><C-y><ESC>')
eq('foo', eval('getline(2)'))
+ feed('o<C-r>=TestComplete()<CR><C-y><ESC>')
+ eq('foo', eval('getline(3)'))
end)
it('does not insert the first candidate if noselect', function()
execute('set completeopt+=menuone,noselect')
feed('ifoo<ESC>o<C-x><C-n>bar<ESC>')
eq('bar', eval('getline(2)'))
+ feed('o<C-r>=TestComplete()<CR>bar<ESC>')
+ eq('bar', eval('getline(3)'))
end)
it('does not select/insert the first candidate if noselect and noinsert', function()
execute('set completeopt+=menuone,noselect,noinsert')
feed('ifoo<ESC>o<C-x><C-n><ESC>')
eq('', eval('getline(2)'))
+ feed('o<C-r>=TestComplete()<CR><ESC>')
+ eq('', eval('getline(3)'))
end)
end)
end)