test(paste): add tests with virtualedit=onemore

This commit is contained in:
zeertzjq 2022-03-06 06:56:24 +08:00
parent e4ec8d7d50
commit 3470a9c3de

View File

@ -636,6 +636,7 @@ describe('API', function()
eq('Invalid phase: 4',
pcall_err(request, 'nvim_paste', 'foo', true, 4))
end)
local function run_streamed_paste_tests()
it('stream: multiple chunks form one undo-block', function()
nvim('paste', '1/chunk 1 (start)\n', true, 1)
nvim('paste', '1/chunk 2 (end)\n', true, 3)
@ -741,7 +742,7 @@ describe('API', function()
feed('i||<Esc>')
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
feed('afoo<Esc>u')
feed('$')
feed('2|')
end)
after_each(function()
feed('u')
@ -773,7 +774,7 @@ describe('API', function()
feed('i|xxx<CR>xxx|<Esc>')
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
feed('afoo<Esc>u')
feed('hvhk')
feed('3|vhk')
end)
after_each(function()
feed('u')
@ -808,7 +809,7 @@ describe('API', function()
feed('i||xxx<CR>xxx<Esc>')
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
feed('afoo<Esc>u')
feed('vko')
feed('3|vko')
end)
after_each(function()
feed('u')
@ -836,7 +837,7 @@ describe('API', function()
feed('i||xxx<CR>xxx<Esc>')
-- If nvim_paste() calls :undojoin without making any changes, this makes it an error.
feed('afoo<Esc>u')
feed('vk')
feed('3|vk')
end)
after_each(function()
feed('u')
@ -994,6 +995,16 @@ describe('API', function()
end)
end)
end)
end
describe('without virtualedit,', function()
run_streamed_paste_tests()
end)
describe('with virtualedit=onemore,', function()
before_each(function()
command('set virtualedit=onemore')
end)
run_streamed_paste_tests()
end)
it('non-streaming', function()
-- With final "\n".
nvim('paste', 'line 1\nline 2\nline 3\n', true, -1)