diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-29 22:10:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 22:10:25 +0800 |
commit | d5dc3dad80ab1aef1d5e2afcc4d44a779605da8b (patch) | |
tree | 50a8f20df8aa6b883a7cb2da0bcda564bd12c5dd /test | |
parent | 8c548c9e5416b4e25b51c018ceaa433756ee99b1 (diff) | |
parent | 7ac5359143ef25c4c8c0c427d5533f8d5824ed17 (diff) | |
download | rneovim-d5dc3dad80ab1aef1d5e2afcc4d44a779605da8b.tar.gz rneovim-d5dc3dad80ab1aef1d5e2afcc4d44a779605da8b.tar.bz2 rneovim-d5dc3dad80ab1aef1d5e2afcc4d44a779605da8b.zip |
Merge pull request #18305 from zeertzjq/mapping-rhs
feat(mappings): do not simplify the rhs of a mapping
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ex_cmds/cmd_map_spec.lua | 29 | ||||
-rw-r--r-- | test/functional/ui/input_spec.lua | 5 |
2 files changed, 27 insertions, 7 deletions
diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua index 64cf53dfa9..dbbfadabd8 100644 --- a/test/functional/ex_cmds/cmd_map_spec.lua +++ b/test/functional/ex_cmds/cmd_map_spec.lua @@ -93,7 +93,7 @@ describe('mappings with <Cmd>', function() {2:E5521: <Cmd> mapping must end with <CR> before second <Cmd>} | ]]) - command('noremap <F3> <Cmd><F3>let x = 2<cr>') + command('noremap <F3> <Cmd>let x = 3') feed('<F3>') screen:expect([[ ^some short lines | @@ -103,22 +103,37 @@ describe('mappings with <Cmd>', function() {1:~ }| {1:~ }| {1:~ }| - {2:E5522: <Cmd> mapping must not include <F3> key} | + {2:E5520: <Cmd> mapping must end with <CR>} | ]]) + eq(0, eval('x')) + end) - command('noremap <F3> <Cmd>let x = 3') + it('allows special keys and modifiers', function() + command('noremap <F3> <Cmd>normal! <Down><CR>') feed('<F3>') screen:expect([[ - ^some short lines | - of test text | + some short lines | + ^of test text | {1:~ }| {1:~ }| {1:~ }| {1:~ }| {1:~ }| - {2:E5520: <Cmd> mapping must end with <CR>} | + | + ]]) + + command('noremap <F3> <Cmd>normal! <C-Right><CR>') + feed('<F3>') + screen:expect([[ + some short lines | + of ^test text | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | ]]) - eq(0, eval('x')) end) it('works in various modes and sees correct `mode()` value', function() diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index 0f4e97088c..07582ba602 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -313,6 +313,11 @@ it('unsimplified mapping works when there was a partial match vim-patch:8.2.4504 expect('xb') end) +it('rhs of a mapping is not simplified', function() + command('nnoremap <Plug>foo <C-J>') + eq('<C-J>', funcs.maparg('<Plug>foo')) +end) + describe('input non-printable chars', function() after_each(function() os.remove('Xtest-overwrite') |