diff options
author | ZyX <kp-pav@yandex.ru> | 2016-12-25 23:29:35 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-01-03 06:39:23 +0300 |
commit | 759e736b0ab03034dc61d6a30e1b8b1f17ed9695 (patch) | |
tree | 92da5c50e05040dbcad881c270ebade0ca1fc502 /test/functional/eval/string_spec.lua | |
parent | affa3c2baa60acbffd32234326d38cced2d3f30c (diff) | |
download | rneovim-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.lua | 13 |
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() |