diff options
Diffstat (limited to 'test/unit/eval/helpers.lua')
-rw-r--r-- | test/unit/eval/helpers.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/eval/helpers.lua b/test/unit/eval/helpers.lua index 6909953022..a3cb062b7b 100644 --- a/test/unit/eval/helpers.lua +++ b/test/unit/eval/helpers.lua @@ -498,6 +498,16 @@ local function dict_watchers(d) return ret, qs, key_patterns end +local function eval0(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 + return { int=int, @@ -540,5 +550,7 @@ return { tbl2callback=tbl2callback, callback2tbl=callback2tbl, + eval0=eval0, + empty_list = {[type_key]=list_type}, } |