diff options
author | Abdelhakeem <abdelhakeem.osama@hotmail.com> | 2019-07-17 22:00:50 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-07-27 16:36:56 +0200 |
commit | a80f691a6a55a57bd1bfa6d4850ca3316e2f4d3f (patch) | |
tree | 6d035afc8db4f2fc386e1ff7215ef8a78b1cb7f0 /test/functional/helpers.lua | |
parent | 411a06c8b6e92ead6a14d407d7ca61a44fba5bb6 (diff) | |
download | rneovim-a80f691a6a55a57bd1bfa6d4850ca3316e2f4d3f.tar.gz rneovim-a80f691a6a55a57bd1bfa6d4850ca3316e2f4d3f.tar.bz2 rneovim-a80f691a6a55a57bd1bfa6d4850ca3316e2f4d3f.zip |
API: Context
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index ce7d348747..8223290760 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -13,6 +13,8 @@ local check_cores = global_helpers.check_cores local check_logs = global_helpers.check_logs local dedent = global_helpers.dedent local eq = global_helpers.eq +local filter = global_helpers.filter +local map = global_helpers.map local ok = global_helpers.ok local sleep = global_helpers.sleep local tbl_contains = global_helpers.tbl_contains @@ -763,6 +765,22 @@ local function load_adjust(num) return math.ceil(num * load_factor) end +local function parse_context(ctx) + local parsed = {} + for _, item in ipairs({'regs', 'jumps', 'buflist', 'gvars'}) do + parsed[item] = filter(function(v) + return type(v) == 'table' + end, nvim_call('msgpackparse', ctx[item])) + end + parsed['buflist'] = parsed['buflist'][1] + return map(function(v) + if #v == 0 then + return nil + end + return v + end, parsed) +end + local module = { NIL = mpack.NIL, alter_slashes = alter_slashes, @@ -810,6 +828,7 @@ local module = { nvim_prog_abs = nvim_prog_abs, nvim_set = nvim_set, os_name = os_name, + parse_context = parse_context, pathroot = pathroot, pending_win32 = pending_win32, prepend_argv = prepend_argv, |