mirror of
https://github.com/neovim/neovim.git
synced 2026-01-20 20:00:37 +00:00
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.
59 lines
1.6 KiB
Lua
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)
|