aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/server_notifications_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-06-25 15:44:39 -0400
committerGitHub <noreply@github.com>2016-06-25 15:44:39 -0400
commit26d8ab51daf8ff524d7f6edb843fe1c61f943425 (patch)
treed8a9b9311888272da3301c7e0b9396b19fd65b1c /test/functional/api/server_notifications_spec.lua
parentbe0f96ab73733d611c5a719298dfd167e340e276 (diff)
parent142d00e8dacfee2aa78ca7a267736fbeff0b3c41 (diff)
downloadrneovim-26d8ab51daf8ff524d7f6edb843fe1c61f943425.tar.gz
rneovim-26d8ab51daf8ff524d7f6edb843fe1c61f943425.tar.bz2
rneovim-26d8ab51daf8ff524d7f6edb843fe1c61f943425.zip
Merge #4607 from ZyX-I/luaviml'/lua'/encode_vim_to_object
Remove recursion from various serializers/converters
Diffstat (limited to 'test/functional/api/server_notifications_spec.lua')
-rw-r--r--test/functional/api/server_notifications_spec.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/functional/api/server_notifications_spec.lua b/test/functional/api/server_notifications_spec.lua
index d68ce411c0..88e8c60560 100644
--- a/test/functional/api/server_notifications_spec.lua
+++ b/test/functional/api/server_notifications_spec.lua
@@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local eq, clear, eval, execute, nvim, next_message =
helpers.eq, helpers.clear, helpers.eval, helpers.execute, helpers.nvim,
helpers.next_message
+local meths = helpers.meths
describe('notify', function()
local channel
@@ -36,5 +37,33 @@ describe('notify', function()
eval('rpcnotify(0, "event1", 13, 14, 15)')
eq({'notification', 'event1', {13, 14, 15}}, next_message())
end)
+
+ it('does not crash for deeply nested variable', function()
+ meths.set_var('l', {})
+ local nest_level = 1000
+ meths.command(('call map(range(%u), "extend(g:, {\'l\': [g:l]})")'):format(nest_level - 1))
+ eval('rpcnotify('..channel..', "event", g:l)')
+ local msg = next_message()
+ eq('notification', msg[1])
+ eq('event', msg[2])
+ local act_ret = msg[3]
+ local act_nest_level = 0
+ while act_ret do
+ if type(act_ret) == 'table' then
+ local cur_act_ret = nil
+ for k, v in pairs(act_ret) do
+ eq(1, k)
+ cur_act_ret = v
+ end
+ if cur_act_ret then
+ act_nest_level = act_nest_level + 1
+ end
+ act_ret = cur_act_ret
+ else
+ eq(nil, act_ret)
+ end
+ end
+ eq(nest_level, act_nest_level)
+ end)
end)
end)