aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/json_functions_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-03 22:51:29 +0300
committerZyX <kp-pav@yandex.ru>2017-01-03 22:51:29 +0300
commit136b382e64390bf3129a7cd127b7704c983ec300 (patch)
treee2d352e1236e6ecb82f6c70478ecd74056f1bc21 /test/functional/eval/json_functions_spec.lua
parentefc624c2fe029a4ab494672c43366e8c57c19108 (diff)
downloadrneovim-136b382e64390bf3129a7cd127b7704c983ec300.tar.gz
rneovim-136b382e64390bf3129a7cd127b7704c983ec300.tar.bz2
rneovim-136b382e64390bf3129a7cd127b7704c983ec300.zip
tests: Add tests for partials dumping
Also fixed dumping of partials by encode_vim_to_object and added code which is able to work with partials and dictionaries to test/unit/eval/helpers.lua (mostly copied from #5119, except for partials handling).
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r--test/functional/eval/json_functions_spec.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index 4a6758019b..fc0a19bdfa 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -672,6 +672,12 @@ describe('json_encode() function', function()
exc_exec('call json_encode(function("tr"))'))
end)
+ it('fails to dump a partial', function()
+ execute('function T() dict\nendfunction')
+ eq('Vim(call):E474: Error while dumping encode_tv2json() argument, itself: attempt to dump function reference',
+ exc_exec('call json_encode(function("T", [1, 2], {}))'))
+ end)
+
it('fails to dump a function reference in a list', function()
eq('Vim(call):E474: Error while dumping encode_tv2json() argument, index 0: attempt to dump function reference',
exc_exec('call json_encode([function("tr")])'))