diff options
Diffstat (limited to 'test/unit/eval/helpers.lua')
-rw-r--r-- | test/unit/eval/helpers.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/unit/eval/helpers.lua b/test/unit/eval/helpers.lua index 3d1c42c3a0..b600f01ab2 100644 --- a/test/unit/eval/helpers.lua +++ b/test/unit/eval/helpers.lua @@ -136,11 +136,15 @@ local function typvalt2lua_tab_init() return end typvalt2lua_tab = { + [tonumber(eval.VAR_BOOL)] = function(t) + return ({ + [tonumber(eval.kBoolVarFalse)] = false, + [tonumber(eval.kBoolVarTrue)] = true, + })[tonumber(t.vval.v_bool)] + end, [tonumber(eval.VAR_SPECIAL)] = function(t) return ({ - [tonumber(eval.kSpecialVarFalse)] = false, [tonumber(eval.kSpecialVarNull)] = nil_value, - [tonumber(eval.kSpecialVarTrue)] = true, })[tonumber(t.vval.v_special)] end, [tonumber(eval.VAR_NUMBER)] = function(t) @@ -349,8 +353,8 @@ lua2typvalt = function(l, processed) [null_list] = {'VAR_LIST', {v_list=ffi.cast('list_T*', nil)}}, [null_dict] = {'VAR_DICT', {v_dict=ffi.cast('dict_T*', nil)}}, [nil_value] = {'VAR_SPECIAL', {v_special=eval.kSpecialVarNull}}, - [true] = {'VAR_SPECIAL', {v_special=eval.kSpecialVarTrue}}, - [false] = {'VAR_SPECIAL', {v_special=eval.kSpecialVarFalse}}, + [true] = {'VAR_BOOL', {v_bool=eval.kBoolVarTrue}}, + [false] = {'VAR_BOOL', {v_bool=eval.kBoolVarFalse}}, } for k, v in pairs(special_vals) do @@ -406,7 +410,7 @@ end local alloc_logging_helpers = { list = function(l) return {func='calloc', args={1, ffi.sizeof('list_T')}, ret=void(l)} end, li = function(li) return {func='malloc', args={ffi.sizeof('listitem_T')}, ret=void(li)} end, - dict = function(d) return {func='malloc', args={ffi.sizeof('dict_T')}, ret=void(d)} end, + dict = function(d) return {func='calloc', args={1, ffi.sizeof('dict_T')}, ret=void(d)} end, di = function(di, size) size = alloc_len(size, function() return di.di_key end) return {func='malloc', args={ffi.offsetof('dictitem_T', 'di_key') + size + 1}, ret=void(di)} |