diff options
author | ZyX <kp-pav@yandex.ru> | 2017-03-11 23:48:16 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-11 23:48:16 +0300 |
commit | 8ef6cfa6ac4e15ab8296098e875bed4353396bb1 (patch) | |
tree | 0f2db15b5ea28a130a9b38fa8385d747463b8454 /test/unit/api/helpers.lua | |
parent | a54be846cf0df18af9d634b180edb7b92f7249fc (diff) | |
download | rneovim-8ef6cfa6ac4e15ab8296098e875bed4353396bb1.tar.gz rneovim-8ef6cfa6ac4e15ab8296098e875bed4353396bb1.tar.bz2 rneovim-8ef6cfa6ac4e15ab8296098e875bed4353396bb1.zip |
unittests: Fix linter errors
Diffstat (limited to 'test/unit/api/helpers.lua')
-rw-r--r-- | test/unit/api/helpers.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/unit/api/helpers.lua b/test/unit/api/helpers.lua index bbd5e8e4df..4fb1cee4b3 100644 --- a/test/unit/api/helpers.lua +++ b/test/unit/api/helpers.lua @@ -19,8 +19,13 @@ local api = cimport('./src/nvim/api/private/defs.h', local obj2lua -obj2lua = function(obj) - local obj2lua_tab = { +local obj2lua_tab = nil + +local function init_obj2lua_tab() + if obj2lua_tab then + return + end + obj2lua_tab = { [tonumber(api.kObjectTypeArray)] = function(obj) local ret = {[type_key]=list_type} for i = 1,tonumber(obj.data.array.size) do @@ -59,6 +64,10 @@ obj2lua = function(obj) return ffi.string(obj.data.string.data, obj.data.string.size) end, } +end + +obj2lua = function(obj) + init_obj2lua_tab() return ((obj2lua_tab[tonumber(obj['type'])] or function(obj_inner) assert(false, 'Converting ' .. tostring(tonumber(obj_inner['type'])) .. ' is not implementing yet') end)(obj)) |