unittests: Add tests for tv_dict_extend

This commit is contained in:
ZyX
2017-03-13 14:35:53 +03:00
parent fa852e7cdc
commit 8b9a1fbf7a
3 changed files with 144 additions and 11 deletions

View File

@@ -1,4 +1,6 @@
local helpers = require('test.unit.helpers')(after_each)
local eval_helpers = require('test.unit.eval.helpers')
local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
@@ -6,19 +8,11 @@ local to_cstr = helpers.to_cstr
local ffi = helpers.ffi
local eq = helpers.eq
local eval0 = eval_helpers.eval0
local eval = cimport('./src/nvim/eval.h', './src/nvim/eval/typval.h',
'./src/nvim/memory.h')
local eval0 = function(expr)
local tv = ffi.gc(ffi.new('typval_T', {v_type=eval.VAR_UNKNOWN}),
eval.tv_clear)
if eval.eval0(to_cstr(expr), tv, nil, true) == 0 then
return nil
else
return tv
end
end
describe('NULL typval_T', function()
itp('is produced by $XXX_UNEXISTENT_VAR_XXX', function()
-- Required for various tests which need to check whether typval_T with NULL