diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-16 14:05:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 14:05:09 +0800 |
commit | 7fa24948a936a95519f0c8c496402488b6508c14 (patch) | |
tree | d19db7a1780f17e6a5b15e7950db8c5132231afc /test/functional/vimscript/map_functions_spec.lua | |
parent | 47ba96a6b3bf22097134b319ed97ec840b05eaa7 (diff) | |
download | rneovim-7fa24948a936a95519f0c8c496402488b6508c14.tar.gz rneovim-7fa24948a936a95519f0c8c496402488b6508c14.tar.bz2 rneovim-7fa24948a936a95519f0c8c496402488b6508c14.zip |
test: make mapping tests more consistent (#28368)
- Test maparg() and maplist() in the same test.
- Use matches() instead of string.match().
- Avoid overlong lines and strange spacing in exec_lua().
- Revert code change from last PR as the variable may be needed.
Diffstat (limited to 'test/functional/vimscript/map_functions_spec.lua')
-rw-r--r-- | test/functional/vimscript/map_functions_spec.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/functional/vimscript/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua index 7bf835102c..249b79aa4e 100644 --- a/test/functional/vimscript/map_functions_spec.lua +++ b/test/functional/vimscript/map_functions_spec.lua @@ -233,7 +233,9 @@ describe('mapset()', function() 0, exec_lua([[ GlobalCount = 0 - vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end }) + vim.api.nvim_set_keymap('n', 'asdf', '', { + callback = function() GlobalCount = GlobalCount + 1 end, + }) return GlobalCount ]]) ) @@ -242,7 +244,9 @@ describe('mapset()', function() exec_lua([[ _G.saved_asdf_map = vim.fn.maparg('asdf', 'n', false, true) - vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 10 end }) + vim.api.nvim_set_keymap('n', 'asdf', '', { + callback = function() GlobalCount = GlobalCount + 10 end, + }) ]]) feed('asdf') eq(11, exec_lua([[return GlobalCount]])) @@ -253,7 +257,10 @@ describe('mapset()', function() exec([[ let g:saved_asdf_map = maparg('asdf', 'n', v:false, v:true) - lua vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 10 end }) + lua << + vim.api.nvim_set_keymap('n', 'asdf', '', { + callback = function() GlobalCount = GlobalCount + 10 end, + }) ]]) feed('asdf') eq(22, exec_lua([[return GlobalCount]])) |