diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-09 06:57:18 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-12-09 07:00:27 +0800 |
commit | 95044991e618827924ac47aeae8bd0eacc775f58 (patch) | |
tree | e8e3c0452677dfee45f1c7d62e5b600130919b6c | |
parent | 70d6c335b17cf166760457e3673aa61098ef0e66 (diff) | |
download | rneovim-95044991e618827924ac47aeae8bd0eacc775f58.tar.gz rneovim-95044991e618827924ac47aeae8bd0eacc775f58.tar.bz2 rneovim-95044991e618827924ac47aeae8bd0eacc775f58.zip |
test(undo_spec): add more tests for writing in Insert mode
-rw-r--r-- | test/functional/editor/undo_spec.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/editor/undo_spec.lua b/test/functional/editor/undo_spec.lua index 6f9c4506fc..d66ab352ef 100644 --- a/test/functional/editor/undo_spec.lua +++ b/test/functional/editor/undo_spec.lua @@ -10,6 +10,7 @@ local feed_command = helpers.feed_command local insert = helpers.insert local funcs = helpers.funcs local exec = helpers.exec +local exec_lua = helpers.exec_lua local function lastmessage() local messages = funcs.split(funcs.execute('messages'), '\n') @@ -101,6 +102,45 @@ describe('u CTRL-R g- g+', function() feed('u') expect('') end) + + it('using Lua mapping', function() + exec_lua([[ + vim.api.nvim_set_keymap('i', '.', '', {callback = function() + vim.cmd('write') + end}) + ]]) + feed('Otest.<CR>boo!!!<Esc>') + expect([[ + test + boo!!! + ]]) + + feed('u') + expect([[ + test + ]]) + + feed('u') + expect('') + end) + + it('using RPC call', function() + feed('Otest') + command('write') + feed('<CR>boo!!!<Esc>') + expect([[ + test + boo!!! + ]]) + + feed('u') + expect([[ + test + ]]) + + feed('u') + expect('') + end) end) end) |