diff options
author | ZyX <kp-pav@yandex.ru> | 2017-01-03 22:51:29 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-01-03 22:51:29 +0300 |
commit | 136b382e64390bf3129a7cd127b7704c983ec300 (patch) | |
tree | e2d352e1236e6ecb82f6c70478ecd74056f1bc21 /test/unit/api | |
parent | efc624c2fe029a4ab494672c43366e8c57c19108 (diff) | |
download | rneovim-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/unit/api')
-rw-r--r-- | test/unit/api/private_helpers_spec.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/api/private_helpers_spec.lua b/test/unit/api/private_helpers_spec.lua index 1d7c03787b..e108d46370 100644 --- a/test/unit/api/private_helpers_spec.lua +++ b/test/unit/api/private_helpers_spec.lua @@ -7,6 +7,7 @@ local NULL = helpers.NULL local eq = helpers.eq local lua2typvalt = eval_helpers.lua2typvalt +local typvalt2lua = eval_helpers.typvalt2lua local typvalt = eval_helpers.typvalt local nil_value = api_helpers.nil_value @@ -14,6 +15,7 @@ local list_type = api_helpers.list_type local int_type = api_helpers.int_type local type_key = api_helpers.type_key local obj2lua = api_helpers.obj2lua +local func_type = api_helpers.func_type local api = cimport('./src/nvim/api/private/helpers.h') @@ -85,4 +87,20 @@ describe('vim_to_object', function() eq(nil, tt.vval.v_dict) eq({}, obj2lua(api.vim_to_object(tt))) end) + + it('regression: partials in a list', function() + local llist = { + { + [type_key]=func_type, + value='printf', + args={'%s'}, + dict={v=1}, + }, + {}, + } + local ffi=require'ffi' + local list = lua2typvalt(llist) + eq(llist, typvalt2lua(list)) + eq({nil_value, {}}, obj2lua(api.vim_to_object(list))) + end) end) |