diff options
author | ZyX <kp-pav@yandex.ru> | 2016-09-04 02:50:50 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-29 10:08:05 +0300 |
commit | 5df35297f832b3247c18253c916be6066c603739 (patch) | |
tree | d991830be05ace5b0b92ca8a0ff49eeb3e72dc60 /test/unit/eval/tricks_spec.lua | |
parent | c8e63a8db84e9d9f7bd855085a87d93631504fc7 (diff) | |
download | rneovim-5df35297f832b3247c18253c916be6066c603739.tar.gz rneovim-5df35297f832b3247c18253c916be6066c603739.tar.bz2 rneovim-5df35297f832b3247c18253c916be6066c603739.zip |
eval: Remove eval_expr() completely
Diffstat (limited to 'test/unit/eval/tricks_spec.lua')
-rw-r--r-- | test/unit/eval/tricks_spec.lua | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/test/unit/eval/tricks_spec.lua b/test/unit/eval/tricks_spec.lua index 7f0a445f2c..54029734fb 100644 --- a/test/unit/eval/tricks_spec.lua +++ b/test/unit/eval/tricks_spec.lua @@ -6,13 +6,17 @@ local to_cstr = helpers.to_cstr local ffi = helpers.ffi local eq = helpers.eq -local eval = cimport('./src/nvim/eval.h', './src/nvim/memory.h') +local eval = cimport('./src/nvim/eval.h', './src/nvim/eval/typval.h', + './src/nvim/memory.h') -local eval_expr = function(expr) - return ffi.gc(eval.eval_expr(to_cstr(expr), nil), function(tv) - eval.tv_clear(tv) - eval.xfree(tv) - end) +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() @@ -25,19 +29,19 @@ describe('NULL typval_T', function() while os.getenv(unexistent_env) ~= nil do unexistent_env = unexistent_env .. '_XXX' end - local rettv = eval_expr('$' .. unexistent_env) + local rettv = eval0('$' .. unexistent_env) eq(eval.VAR_STRING, rettv.v_type) eq(nil, rettv.vval.v_string) end) itp('is produced by v:_null_list', function() - local rettv = eval_expr('v:_null_list') + local rettv = eval0('v:_null_list') eq(eval.VAR_LIST, rettv.v_type) eq(nil, rettv.vval.v_list) end) itp('is produced by v:_null_dict', function() - local rettv = eval_expr('v:_null_dict') + local rettv = eval0('v:_null_dict') eq(eval.VAR_DICT, rettv.v_type) eq(nil, rettv.vval.v_dict) end) |