aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/string_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-12-25 23:29:35 +0300
committerZyX <kp-pav@yandex.ru>2017-01-03 06:39:23 +0300
commit759e736b0ab03034dc61d6a30e1b8b1f17ed9695 (patch)
tree92da5c50e05040dbcad881c270ebade0ca1fc502 /test/functional/eval/string_spec.lua
parentaffa3c2baa60acbffd32234326d38cced2d3f30c (diff)
downloadrneovim-759e736b0ab03034dc61d6a30e1b8b1f17ed9695.tar.gz
rneovim-759e736b0ab03034dc61d6a30e1b8b1f17ed9695.tar.bz2
rneovim-759e736b0ab03034dc61d6a30e1b8b1f17ed9695.zip
eval/typval_encode: Fix infinite loop
Occurs when trying to dump a partial with attached self dictionary which references that partial. “Infinite” loop should normally result in Neovim killed by OOM killer. Also moved the place when partials are unreferenced by clear_tv: from …FUNC_START to …FUNC_END.
Diffstat (limited to 'test/functional/eval/string_spec.lua')
-rw-r--r--test/functional/eval/string_spec.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/eval/string_spec.lua b/test/functional/eval/string_spec.lua
index 9e2dc4e111..1f963c674e 100644
--- a/test/functional/eval/string_spec.lua
+++ b/test/functional/eval/string_spec.lua
@@ -9,6 +9,7 @@ local redir_exec = helpers.redir_exec
local funcs = helpers.funcs
local write_file = helpers.write_file
local NIL = helpers.NIL
+local source = helpers.source
describe('string() function', function()
before_each(clear)
@@ -137,6 +138,18 @@ describe('string() function', function()
it('dumps references to script functions', function()
eq('function(\'<SNR>1_Test2\')', eval('string(Test2_f)'))
end)
+
+ it('dumps partials with self referencing a partial', function()
+ source([[
+ function TestDict() dict
+ endfunction
+ let d = {}
+ let TestDictRef = function('TestDict', d)
+ let d.tdr = TestDictRef
+ ]])
+ eq("\nE724: unable to correctly dump variable with self-referencing container\nfunction('TestDict', {'tdr': function('TestDict', {E724@1})})",
+ redir_exec('echo string(d.tdr)'))
+ end)
end)
describe('used to represent lists', function()