mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
functests: Add tests for new fixes
This commit is contained in:
parent
1052009b37
commit
527636f158
@ -178,6 +178,18 @@ describe('string() function', function()
|
|||||||
redir_exec('echo string(extend(extend(g:d, {"f": g:Test2_f}), {"p": g:d.f}))'))
|
redir_exec('echo string(extend(extend(g:d, {"f": g:Test2_f}), {"p": g:d.f}))'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not show errors when dumping partials referencing the same dictionary',
|
||||||
|
function()
|
||||||
|
command('let d = {}')
|
||||||
|
-- Regression for “eval/typval_encode: Dump empty dictionary before
|
||||||
|
-- checking for refcycle”, results in error.
|
||||||
|
eq('[function(\'tr\', {}), function(\'tr\', {})]', eval('string([function("tr", d), function("tr", d)])'))
|
||||||
|
-- Regression for “eval: Work with reference cycles in partials (self)
|
||||||
|
-- properly”, results in crash.
|
||||||
|
eval('extend(d, {"a": 1})')
|
||||||
|
eq('[function(\'tr\', {\'a\': 1}), function(\'tr\', {\'a\': 1})]', eval('string([function("tr", d), function("tr", d)])'))
|
||||||
|
end)
|
||||||
|
|
||||||
it('does not crash or halt when dumping partials with reference cycles in arguments',
|
it('does not crash or halt when dumping partials with reference cycles in arguments',
|
||||||
function()
|
function()
|
||||||
meths.set_var('l', {})
|
meths.set_var('l', {})
|
||||||
@ -243,6 +255,13 @@ describe('string() function', function()
|
|||||||
eq('{}', eval('string({})'))
|
eq('{}', eval('string({})'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('dumps list with two same empty dictionaries, also in partials', function()
|
||||||
|
command('let d = {}')
|
||||||
|
eq('[{}, {}]', eval('string([d, d])'))
|
||||||
|
eq('[function(\'tr\', {}), {}]', eval('string([function("tr", d), d])'))
|
||||||
|
eq('[{}, function(\'tr\', {})]', eval('string([d, function("tr", d)])'))
|
||||||
|
end)
|
||||||
|
|
||||||
it('dumps non-empty dictionary', function()
|
it('dumps non-empty dictionary', function()
|
||||||
eq('{\'t\'\'est\': 1}', funcs.string({['t\'est']=1}))
|
eq('{\'t\'\'est\': 1}', funcs.string({['t\'est']=1}))
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user