diff options
author | ZyX <kp-pav@yandex.ru> | 2017-12-24 00:29:38 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-12-24 00:32:43 +0300 |
commit | 6b45dbca0429c52cb70908497bc7a0fed9db2d8d (patch) | |
tree | 6e176aa38cf213ebda85da57523af1ddd3d3e979 /test/functional/shada/marks_spec.lua | |
parent | dee78a4095a27369e428572f74f7b64bcc5f670e (diff) | |
download | rneovim-6b45dbca0429c52cb70908497bc7a0fed9db2d8d.tar.gz rneovim-6b45dbca0429c52cb70908497bc7a0fed9db2d8d.tar.bz2 rneovim-6b45dbca0429c52cb70908497bc7a0fed9db2d8d.zip |
mark: Make sure that jumplist item will not have zero lnum
Fixes #7169
Diffstat (limited to 'test/functional/shada/marks_spec.lua')
-rw-r--r-- | test/functional/shada/marks_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua index fa760ceb5b..4cceae1aa3 100644 --- a/test/functional/shada/marks_spec.lua +++ b/test/functional/shada/marks_spec.lua @@ -9,6 +9,8 @@ local shada_helpers = require('test.functional.shada.helpers') local reset, set_additional_cmd, clear = shada_helpers.reset, shada_helpers.set_additional_cmd, shada_helpers.clear +local add_argv = shada_helpers.add_argv +local nvim_argv = shada_helpers.nvim_argv local nvim_current_line = function() return curwinmeths.get_cursor()[1] @@ -17,8 +19,10 @@ end describe('ShaDa support code', function() local testfilename = 'Xtestfile-functional-shada-marks' local testfilename_2 = 'Xtestfile-functional-shada-marks-2' + local non_existent_testfilename = testfilename .. '.nonexistent' before_each(function() reset() + os.remove(non_existent_testfilename) local fd = io.open(testfilename, 'w') fd:write('test\n') fd:write('test2\n') @@ -214,4 +218,23 @@ describe('ShaDa support code', function() nvim_command('" sync 2') eq(2, nvim_current_line()) end) + + -- -c temporary sets lnum to zero to make `+/pat` work, so calling setpcmark() + -- during -c used to add item with zero lnum to jump list. + it('does not create incorrect file for non-existent buffers when writing from -c', + function() + add_argv('--cmd', 'silent edit ' .. non_existent_testfilename, '-c', 'qall') + local argv = nvim_argv(nil, '--headless') + eq('', funcs.system(argv)) + eq(0, exc_exec('rshada')) + end) + + it('does not create incorrect file for non-existent buffers opened from -c', + function() + add_argv('-c', 'silent edit ' .. non_existent_testfilename, + '-c', 'autocmd VimEnter * qall') + local argv = nvim_argv(nil, '--headless') + eq('', funcs.system(argv)) + eq(0, exc_exec('rshada')) + end) end) |