Skip to content

Instantly share code, notes, and snippets.

@Shougo
Created May 29, 2015 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shougo/97dec021f8c2646051d3 to your computer and use it in GitHub Desktop.
Save Shougo/97dec021f8c2646051d3 to your computer and use it in GitHub Desktop.
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
local execute, source = helpers.execute, helpers.source
describe("completion", function()
before_each(function()
clear()
end)
describe("completeopt", function()
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)'))
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)'))
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)'))
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)'))
end)
end)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment