diff options
author | ZyX <kp-pav@yandex.ru> | 2015-06-28 08:06:16 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2015-10-08 21:59:53 +0300 |
commit | 200e62efebe8e87fc612218b675b74def57519f1 (patch) | |
tree | 6aa90a5522f5ef70a9eb3b6d8edb10a477c171a7 /test | |
parent | 9ab08c82569d57fad29da95dc776ae288300903e (diff) | |
download | rneovim-200e62efebe8e87fc612218b675b74def57519f1.tar.gz rneovim-200e62efebe8e87fc612218b675b74def57519f1.tar.bz2 rneovim-200e62efebe8e87fc612218b675b74def57519f1.zip |
shada: Add support for dumping/restoring bufs changes and win jumps
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/shada/marks_spec.lua | 80 |
1 files changed, 77 insertions, 3 deletions
diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua index 04a49a6d44..b853513317 100644 --- a/test/functional/shada/marks_spec.lua +++ b/test/functional/shada/marks_spec.lua @@ -1,8 +1,8 @@ -- ShaDa marks saving/reading support local helpers = require('test.functional.helpers') -local nvim, nvim_window, nvim_curwin, nvim_command, nvim_eval, eq = - helpers.nvim, helpers.window, helpers.curwin, helpers.command, helpers.eval, - helpers.eq +local nvim, nvim_window, nvim_curwin, nvim_command, nvim_feed, nvim_eval, eq = + helpers.nvim, helpers.window, helpers.curwin, helpers.command, helpers.feed, + helpers.eval, helpers.eq local shada_helpers = require('test.functional.shada.helpers') local reset, set_additional_cmd, clear = @@ -15,16 +15,22 @@ end describe('ShaDa support code', function() testfilename = 'Xtestfile-functional-shada-marks' + testfilename_2 = 'Xtestfile-functional-shada-marks-2' before_each(function() reset() local fd = io.open(testfilename, 'w') fd:write('test\n') fd:write('test2\n') fd:close() + local fd = io.open(testfilename_2, 'w') + fd:write('test3\n') + fd:write('test4\n') + fd:close() end) after_each(function() clear() os.remove(testfilename) + os.remove(testfilename_2) end) it('is able to dump and read back global mark', function() @@ -74,4 +80,72 @@ describe('ShaDa support code', function() nvim_command('normal! `b') eq(2, nvim_current_line()) end) + + it('is able to dump and restore jump list', function() + nvim_command('edit ' .. testfilename_2) + nvim_feed('G') + nvim_feed('gg') + nvim_command('edit ' .. testfilename) + nvim_feed('G') + nvim_feed('gg') + -- nvim_command('redir! >/tmp/jumps.last | jumps | redir END') + -- nvim_command('wviminfo /tmp/foo') + nvim_command('qall') + reset() + nvim_command('redraw') + -- nvim_command('redir! >/tmp/jumps.init | jumps | redir END') + nvim_command('edit ' .. testfilename) + -- nvim_command('redir! >/tmp/jumps | jumps | redir END') + eq(testfilename, nvim_eval('bufname("%")')) + eq(1, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename, nvim_eval('bufname("%")')) + eq(1, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename, nvim_eval('bufname("%")')) + eq(2, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename_2, nvim_eval('bufname("%")')) + eq(1, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename_2, nvim_eval('bufname("%")')) + eq(2, nvim_current_line()) + end) + + it('is able to dump and restore jump list with different times (slow!)', + function() + nvim_command('edit ' .. testfilename_2) + nvim_command('sleep 2') + nvim_feed('G') + nvim_command('sleep 2') + nvim_feed('gg') + nvim_command('sleep 2') + nvim_command('edit ' .. testfilename) + nvim_command('sleep 2') + nvim_feed('G') + nvim_command('sleep 2') + nvim_feed('gg') + -- nvim_command('redir! >/tmp/jumps.last | jumps | redir END') + -- nvim_command('wviminfo /tmp/foo') + nvim_command('qall') + reset() + nvim_command('redraw') + -- nvim_command('redir! >/tmp/jumps.init | jumps | redir END') + nvim_command('edit ' .. testfilename) + -- nvim_command('redir! >/tmp/jumps | jumps | redir END') + eq(testfilename, nvim_eval('bufname("%")')) + eq(1, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename, nvim_eval('bufname("%")')) + eq(1, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename, nvim_eval('bufname("%")')) + eq(2, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename_2, nvim_eval('bufname("%")')) + eq(1, nvim_current_line()) + nvim_command('execute "normal! \\<C-o>"') + eq(testfilename_2, nvim_eval('bufname("%")')) + eq(2, nvim_current_line()) + end) end) |