mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
Merge pull request #17569 from zeertzjq/test-mapping
test: move two mapping tests to ex_cmds/map_spec.lua
This commit is contained in:
commit
1fdf903911
@ -880,24 +880,6 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
|
|||||||
eq("\nn lhs rhs\n map description",
|
eq("\nn lhs rhs\n map description",
|
||||||
helpers.exec_capture("nmap lhs"))
|
helpers.exec_capture("nmap lhs"))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it ('can :filter maps based on description', function()
|
|
||||||
meths.set_keymap('n', 'asdf1', 'qwert', {desc='do the one thing'})
|
|
||||||
meths.set_keymap('n', 'asdf2', 'qwert', {desc='doesnot really do anything'})
|
|
||||||
meths.set_keymap('n', 'asdf3', 'qwert', {desc='do the other thing'})
|
|
||||||
eq([[
|
|
||||||
|
|
||||||
n asdf3 qwert
|
|
||||||
do the other thing
|
|
||||||
n asdf1 qwert
|
|
||||||
do the one thing]],
|
|
||||||
helpers.exec_capture('filter the nmap'))
|
|
||||||
end)
|
|
||||||
|
|
||||||
it ('shows <nop> as map rhs', function()
|
|
||||||
meths.set_keymap('n', 'asdf', '<nop>', {})
|
|
||||||
eq('\nn asdf <Nop>', helpers.exec_capture('nmap asdf'))
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
|
describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
|
||||||
|
@ -30,6 +30,27 @@ describe(':*map', function()
|
|||||||
expect('-foo-')
|
expect('-foo-')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('shows <nop> as mapping rhs', function()
|
||||||
|
command('nmap asdf <Nop>')
|
||||||
|
eq([[
|
||||||
|
|
||||||
|
n asdf <Nop>]],
|
||||||
|
helpers.exec_capture('nmap asdf'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('mappings with description can be filtered', function()
|
||||||
|
meths.set_keymap('n', 'asdf1', 'qwert', {desc='do the one thing'})
|
||||||
|
meths.set_keymap('n', 'asdf2', 'qwert', {desc='doesnot really do anything'})
|
||||||
|
meths.set_keymap('n', 'asdf3', 'qwert', {desc='do the other thing'})
|
||||||
|
eq([[
|
||||||
|
|
||||||
|
n asdf3 qwert
|
||||||
|
do the other thing
|
||||||
|
n asdf1 qwert
|
||||||
|
do the one thing]],
|
||||||
|
helpers.exec_capture('filter the nmap'))
|
||||||
|
end)
|
||||||
|
|
||||||
it('<Plug> mappings ignore nore', function()
|
it('<Plug> mappings ignore nore', function()
|
||||||
command('let x = 0')
|
command('let x = 0')
|
||||||
eq(0, meths.eval('x'))
|
eq(0, meths.eval('x'))
|
||||||
|
Loading…
Reference in New Issue
Block a user