aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/msgpack_functions_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2015-09-20 13:16:37 +0300
committerZyX <kp-pav@yandex.ru>2015-09-30 10:09:21 +0300
commit6da3fadd9f490115bf145d55b0fd5a838b9faa8d (patch)
tree002899a28690e7f41c505792f261507ab9ccd294 /test/functional/eval/msgpack_functions_spec.lua
parent622ec95c3f793a814b3e7c0ee697c959f5b77332 (diff)
downloadrneovim-6da3fadd9f490115bf145d55b0fd5a838b9faa8d.tar.gz
rneovim-6da3fadd9f490115bf145d55b0fd5a838b9faa8d.tar.bz2
rneovim-6da3fadd9f490115bf145d55b0fd5a838b9faa8d.zip
eval/msgpackdump(): Use copyID for protecting against recursive input
Should be faster then O(depth) iteration, but removes const qualifiers.
Diffstat (limited to 'test/functional/eval/msgpack_functions_spec.lua')
-rw-r--r--test/functional/eval/msgpack_functions_spec.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/eval/msgpack_functions_spec.lua
index 927d17fca9..943bdfca30 100644
--- a/test/functional/eval/msgpack_functions_spec.lua
+++ b/test/functional/eval/msgpack_functions_spec.lua
@@ -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)')