functests: Check whether it is a problem with an array

This commit is contained in:
ZyX 2017-04-11 10:38:57 +03:00
parent a8ade2441d
commit 78082e8d3e

View File

@ -29,17 +29,22 @@ describe('luaeval(vim.api.…)', function()
end)
end)
describe('with errors', function()
it('transforms API errors from nvim_buf_set_lines into lua errors', function()
it('transforms API error from nvim_buf_set_lines into lua error', 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"})
it('transforms API error from nvim_win_set_cursor into lua error', function()
eq({false, 'Argument "pos" must be a [row, col] array'},
funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, 1, {1, 2, 3})}'))
end)
it('transforms API error from nvim_win_set_cursor + same array as in first test into lua error',
function()
eq({false, 'Argument "pos" must be a [row, col] array'},
funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, 1, {"b\\na"})}'))
end)
end)
it('correctly evaluates API code which calls luaeval', function()