diff options
author | ZyX <kp-pav@yandex.ru> | 2017-05-08 21:06:23 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-05-08 21:21:03 +0300 |
commit | 5b6d598ca8301682d931539ecd6da6a9fabae569 (patch) | |
tree | 92853669a9e0fbd3a3d8a0a6df54d1feecfbdad1 | |
parent | 85bf64da0a06a06548fb06838eddb884fcaef38b (diff) | |
download | rneovim-5b6d598ca8301682d931539ecd6da6a9fabae569.tar.gz rneovim-5b6d598ca8301682d931539ecd6da6a9fabae569.tar.bz2 rneovim-5b6d598ca8301682d931539ecd6da6a9fabae569.zip |
functests: Fix tests
-rw-r--r-- | test/functional/api/window_spec.lua | 7 | ||||
-rw-r--r-- | test/functional/lua/api_spec.lua | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 6882f50a3e..8a65d3f71e 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -9,6 +9,7 @@ local funcs = helpers.funcs local request = helpers.request local NIL = helpers.NIL local meth_pcall = helpers.meth_pcall +local meths = helpers.meths local command = helpers.command -- check if str is visible at the beginning of some line @@ -55,6 +56,12 @@ describe('api/win', function() eq('typing\n some dumb text', curbuf_contents()) end) + it('does not leak memory when using invalid window ID with invalid pos', + function() + eq({false, 'Invalid window id'}, + meth_pcall(meths.win_set_cursor, 1, {"b\na"})) + end) + it('updates the screen, and also when the window is unfocused', function() insert("prologue") feed('100o<esc>') diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua index b07a7a75e4..b1dc5c07fd 100644 --- a/test/functional/lua/api_spec.lua +++ b/test/functional/lua/api_spec.lua @@ -37,13 +37,16 @@ describe('luaeval(vim.api.…)', function() 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})}')) + funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, 0, {1, 2, 3})}')) + -- Used to produce a memory leak due to a bug in nvim_win_set_cursor + eq({false, 'Invalid window id'}, + 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"})}')) + funcs.luaeval('{pcall(vim.api.nvim_win_set_cursor, 0, {"b\\na"})}')) end) end) |