Files
neovim/test/functional/ex_cmds/menu_spec.lua
ZyX 65fb622000 functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs.
Already found at least two:

1. msgpackparse() will show internal error: hash_add() in case of duplicate
   keys, though it will still work correctly. Currently silenced.
2. ttimeoutlen was spelled incorrectly, resulting in option not being set when
   expected. Test was still functioning somehow though. Currently fixed.
2017-04-09 03:24:08 +03:00

59 lines
1.6 KiB
Lua

local helpers = require('test.functional.helpers')(after_each)
local clear, command, nvim = helpers.clear, helpers.command, helpers.nvim
local expect, feed, command = helpers.expect, helpers.feed, helpers.command
local eq, eval = helpers.eq, helpers.eval
describe(':emenu', function()
before_each(function()
clear()
command('nnoremenu Test.Test inormal<ESC>')
command('inoremenu Test.Test insert')
command('vnoremenu Test.Test x')
command('cnoremenu Test.Test cmdmode')
command('nnoremenu Edit.Paste p')
command('cnoremenu Edit.Paste <C-R>"')
end)
it('executes correct bindings in normal mode without using API', function()
command('emenu Test.Test')
expect('normal')
end)
it('executes correct bindings in normal mode', function()
command('emenu Test.Test')
expect('normal')
end)
it('executes correct bindings in insert mode', function()
feed('i')
command('emenu Test.Test')
expect('insert')
end)
it('executes correct bindings in visual mode', function()
feed('iabcde<ESC>0lvll')
command('emenu Test.Test')
expect('ae')
end)
it('executes correct bindings in command mode', function()
feed('ithis is a sentence<esc>^yiwo<esc>')
-- Invoke "Edit.Paste" in normal-mode.
nvim('command', 'emenu Edit.Paste')
-- Invoke "Edit.Paste" and "Test.Test" in command-mode.
feed(':')
nvim('command', 'emenu Edit.Paste')
nvim('command', 'emenu Test.Test')
expect([[
this is a sentence
this]])
-- Assert that Edit.Paste pasted @" into the commandline.
eq('thiscmdmode', eval('getcmdline()'))
end)
end)