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.
This commit is contained in:
ZyX
2017-04-11 02:32:13 +03:00
parent add76592d9
commit acd9ed8d83

View File

@@ -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()