mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
eval/msgpackdump(): Use copyID for protecting against recursive input
Should be faster then O(depth) iteration, but removes const qualifiers.
This commit is contained in:
@@ -565,6 +565,18 @@ describe('msgpackdump() function', function()
|
||||
exc_exec('call msgpackdump([todump])'))
|
||||
end)
|
||||
|
||||
it('can dump dict with two same dicts inside', function()
|
||||
execute('let inter = {}')
|
||||
execute('let todump = {"a": inter, "b": inter}')
|
||||
eq({"\130\161a\128\161b\128"}, eval('msgpackdump([todump])'))
|
||||
end)
|
||||
|
||||
it('can dump list with two same lists inside', function()
|
||||
execute('let inter = []')
|
||||
execute('let todump = [inter, inter]')
|
||||
eq({"\146\144\144"}, eval('msgpackdump([todump])'))
|
||||
end)
|
||||
|
||||
it('fails to dump a recursive list in a special dict', function()
|
||||
execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
|
||||
execute('call add(todump._VAL, todump)')
|
||||
|
Reference in New Issue
Block a user