Files
neovim/test/functional/ex_cmds/menu_spec.lua
James McCoy d45a665b00 test: functional: Remove unnecessary use of clipboard register
menu_spec.lua yanks to the clipboard, but never pastes from it.  This
can leave a child xsel process waiting around for something to paste the
content, causing the test process to hang.

Since the test isn't explicitly trying to exercise the clipboard, simply
use the default register.
2016-06-15 09:54:27 -04:00

59 lines
1.6 KiB
Lua

local helpers = require('test.functional.helpers')(after_each)
local clear, execute, nvim = helpers.clear, helpers.execute, 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()
execute('nnoremenu Test.Test inormal<ESC>')
execute('inoremenu Test.Test insert')
execute('vnoremenu Test.Test x')
execute('cnoremenu Test.Test cmdmode')
execute('nnoremenu Edit.Paste p')
execute('cnoremenu Edit.Paste <C-R>"')
end)
it('executes correct bindings in normal mode without using API', function()
execute('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)