aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-24 13:54:27 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-27 22:13:45 +0200
commiteacc70fb3ebae6d76112ab10647a42339f5f223f (patch)
treeef498c6f108edc29498d319de32417d90d8c0bd7 /test
parentc95f5d166fad75ad8383f76675d06907687066a7 (diff)
downloadrneovim-eacc70fb3ebae6d76112ab10647a42339f5f223f.tar.gz
rneovim-eacc70fb3ebae6d76112ab10647a42339f5f223f.tar.bz2
rneovim-eacc70fb3ebae6d76112ab10647a42339f5f223f.zip
API: nvim_paste
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/vim_spec.lua37
-rw-r--r--test/functional/terminal/tui_spec.lua12
2 files changed, 45 insertions, 4 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 3f3d9b74bb..212c4f4300 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -366,7 +366,44 @@ describe('API', function()
end)
end)
+ describe('nvim_paste', function()
+ it('validates args', function()
+ expect_err('Invalid phase: %-2', request,
+ 'nvim_paste', 'foo', -2)
+ expect_err('Invalid phase: 4', request,
+ 'nvim_paste', 'foo', 4)
+ end)
+ it('non-streaming', function()
+ -- With final "\n".
+ nvim('paste', 'line 1\nline 2\nline 3\n', -1)
+ expect([[
+ line 1
+ line 2
+ line 3
+ ]])
+ -- Cursor follows the paste.
+ eq({0,4,1,0}, funcs.getpos('.'))
+ eq(false, nvim('get_option', 'paste'))
+ command('%delete _')
+ -- Without final "\n".
+ nvim('paste', 'line 1\nline 2\nline 3', -1)
+ expect([[
+ line 1
+ line 2
+ line 3]])
+ -- Cursor follows the paste.
+ eq({0,3,6,0}, funcs.getpos('.'))
+ eq(false, nvim('get_option', 'paste'))
+ end)
+ end)
+
describe('nvim_put', function()
+ it('validates args', function()
+ expect_err('Invalid lines %(expected array of strings%)', request,
+ 'nvim_put', {42}, 'l', false, false)
+ expect_err("Invalid type: 'x'", request,
+ 'nvim_put', {'foo'}, 'x', false, false)
+ end)
it('inserts text', function()
-- linewise
nvim('put', {'line 1','line 2','line 3'}, 'l', true, true)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index adf968712d..414838444f 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -298,19 +298,23 @@ describe('TUI', function()
end)
-- TODO
- it('in normal-mode', function()
+ it('paste: normal-mode', function()
end)
-- TODO
- it('in command-mode', function()
+ it('paste: command-mode inserts 1 line', function()
end)
-- TODO
- it('sets undo-point after consecutive pastes', function()
+ it('paste: sets undo-point after consecutive pastes', function()
+ end)
+
+ it('paste: other modes', function()
+ -- Other modes act like CTRL-C + paste.
end)
-- TODO
- it('handles missing "stop paste" sequence', function()
+ it('paste: handles missing "stop paste" sequence', function()
end)
-- TODO: error when pasting into 'nomodifiable' buffer: