aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-19 23:43:19 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-27 21:19:10 +0200
commite1177be363f84f5f4f34c21b760bc47f70d5fa48 (patch)
tree054aa71f0cc72155ca9eb9c17625e8488ab56117 /test/functional/api/vim_spec.lua
parent9e25a36467228bbcb8c6db88d2acb69cf7145af3 (diff)
downloadrneovim-e1177be363f84f5f4f34c21b760bc47f70d5fa48.tar.gz
rneovim-e1177be363f84f5f4f34c21b760bc47f70d5fa48.tar.bz2
rneovim-e1177be363f84f5f4f34c21b760bc47f70d5fa48.zip
API: nvim_put #6819
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua43
1 files changed, 39 insertions, 4 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 0cd81619c1..09c297940c 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -5,6 +5,7 @@ local NIL = helpers.NIL
local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq
local command = helpers.command
local eval = helpers.eval
+local expect = helpers.expect
local funcs = helpers.funcs
local iswin = helpers.iswin
local meth_pcall = helpers.meth_pcall
@@ -365,6 +366,40 @@ describe('API', function()
end)
end)
+ describe('nvim_put', function()
+ it('inserts text', function()
+ -- linewise
+ nvim('put', {'line 1','line 2','line 3'}, 'l', false)
+ expect([[
+
+ line 1
+ line 2
+ line 3]])
+ command('%delete _')
+ -- charwise
+ nvim('put', {'line 1','line 2','line 3'}, 'c', false)
+ expect([[
+ line 1
+ line 2
+ line 3]])
+ -- blockwise
+ nvim('put', {'AA','BB'}, 'b', false)
+ expect([[
+ lAAine 1
+ lBBine 2
+ line 3]])
+ command('%delete _')
+ -- Empty lines list.
+ nvim('put', {}, 'c', false)
+ expect([[]])
+ -- Single empty line.
+ nvim('put', {''}, 'c', false)
+ expect([[
+ ]])
+ eq('', nvim('eval', 'v:errmsg'))
+ end)
+ end)
+
describe('nvim_strwidth', function()
it('works', function()
eq(3, nvim('strwidth', 'abc'))
@@ -626,12 +661,12 @@ describe('API', function()
-- Make any RPC request (can be non-async: op-pending does not block).
nvim('get_current_buf')
-- Buffer should not change.
- helpers.expect([[
+ expect([[
FIRST LINE
SECOND LINE]])
-- Now send input to complete the operator.
nvim('input', 'j')
- helpers.expect([[
+ expect([[
first line
second line]])
end)
@@ -664,7 +699,7 @@ describe('API', function()
nvim('get_api_info')
-- Send input to complete the mapping.
nvim('input', 'd')
- helpers.expect([[
+ expect([[
FIRST LINE
SECOND LINE]])
eq('it worked...', helpers.eval('g:foo'))
@@ -680,7 +715,7 @@ describe('API', function()
nvim('get_api_info')
-- Send input to complete the mapping.
nvim('input', 'x')
- helpers.expect([[
+ expect([[
FIRST LINE
SECOND LINfooE]])
end)