diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-03-24 12:59:59 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-03-24 12:59:59 -0300 |
commit | ed1070bb24d61cfeb13c7afa65de64540dabe535 (patch) | |
tree | 751ad22670cb9b40329a84773e783ba3b8c357f3 /test/functional/ui/screen.lua | |
parent | 5860d65f9cf4205b845e4fb5e8512ef8929cf227 (diff) | |
parent | 1ee7ca7bc0739526bf07ddc0cfc9fbbd18523591 (diff) | |
download | rneovim-ed1070bb24d61cfeb13c7afa65de64540dabe535.tar.gz rneovim-ed1070bb24d61cfeb13c7afa65de64540dabe535.tar.bz2 rneovim-ed1070bb24d61cfeb13c7afa65de64540dabe535.zip |
Merge PR #2146 'Improve functional test debuggability and efficiency'
Diffstat (limited to 'test/functional/ui/screen.lua')
-rw-r--r-- | test/functional/ui/screen.lua | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index f79d634536..c60944bbb0 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -123,16 +123,26 @@ if os.getenv('CI_TARGET') then default_screen_timeout = default_screen_timeout * 3 end -local colors = request('vim_get_color_map') -local colornames = {} -for name, rgb in pairs(colors) do +do + local spawn, nvim_prog = helpers.spawn, helpers.nvim_prog + local session = spawn({nvim_prog, '-u', 'NONE', '-N', '--embed'}) + local status, rv = session:request('vim_get_color_map') + if not status then + print('failed to get color map') + os.exit(1) + end + local colors = rv + local colornames = {} + for name, rgb in pairs(colors) do -- we disregard the case that colornames might not be unique, as -- this is just a helper to get any canonical name of a color colornames[rgb] = name + end + session:exit(0) + Screen.colors = colors + Screen.colornames = colornames end -Screen.colors = colors - function Screen.debug(command) if not command then command = 'pynvim -n -c ' @@ -497,8 +507,8 @@ function pprint_attrs(attrs) for f, v in pairs(attrs) do local desc = tostring(v) if f == "foreground" or f == "background" then - if colornames[v] ~= nil then - desc = "Screen.colors."..colornames[v] + if Screen.colornames[v] ~= nil then + desc = "Screen.colors."..Screen.colornames[v] end end table.insert(items, f.." = "..desc) |