aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/api_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-11 02:32:13 +0300
committerZyX <kp-pav@yandex.ru>2017-04-11 02:32:13 +0300
commitacd9ed8d8397cbab5c7300b06beda4daa053e9e2 (patch)
treed27827649d0e3f4302e1dcea0cc5d138b8d6e8ff /test/functional/lua/api_spec.lua
parentadd76592d9a690d12e266da1f788e588bb42b919 (diff)
downloadrneovim-acd9ed8d8397cbab5c7300b06beda4daa053e9e2.tar.gz
rneovim-acd9ed8d8397cbab5c7300b06beda4daa053e9e2.tar.bz2
rneovim-acd9ed8d8397cbab5c7300b06beda4daa053e9e2.zip
functests: Add another check for the similar transformation
Reasoning is majorly the same: check whether lua has bug or API function has bug, but on the other side: previous commit is checking whether similar bug when using API via msgpack RPC, this commit is checking whether another API function used via lua bindings triggers the same bug. Should additionally give a hint about which lua code contains a bug.
Diffstat (limited to 'test/functional/lua/api_spec.lua')
-rw-r--r--test/functional/lua/api_spec.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua
index a064e0f98f..7dc7e962fb 100644
--- a/test/functional/lua/api_spec.lua
+++ b/test/functional/lua/api_spec.lua
@@ -29,11 +29,17 @@ describe('luaeval(vim.api.…)', function()
end)
end)
describe('with errors', function()
- it('transforms API errors into lua errors', function()
+ it('transforms API errors from nvim_buf_set_lines into lua errors', function()
funcs.setline(1, {"abc", "def", "a\nb", "ttt"})
eq({false, 'string cannot contain newlines'},
funcs.luaeval('{pcall(vim.api.nvim_buf_set_lines, 1, 1, 2, false, {"b\\na"})}'))
end)
+
+ it('transforms API errors from nvim_win_set_cursor into lua errors', function()
+ funcs.setline(1, {"abc", "def", "a\nb", "ttt"})
+ eq({false, 'Argument "pos" must be a [row, col] array'},
+ funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, 1, {1, 2, 3})}'))
+ end)
end)
it('correctly evaluates API code which calls luaeval', function()