diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/core/main_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/helpers.lua | 11 | ||||
-rw-r--r-- | test/functional/terminal/highlight_spec.lua | 50 |
3 files changed, 60 insertions, 13 deletions
diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua index a0981e9207..b793e531c9 100644 --- a/test/functional/core/main_spec.lua +++ b/test/functional/core/main_spec.lua @@ -7,19 +7,9 @@ local feed = helpers.feed local eval = helpers.eval local clear = helpers.clear local funcs = helpers.funcs -local nvim_prog = helpers.nvim_prog +local nvim_prog_abs = helpers.nvim_prog_abs local write_file = helpers.write_file -local function nvim_prog_abs() - -- system(['build/bin/nvim']) does not work for whatever reason. It needs to - -- either be executable searched in $PATH or something starting with / or ./. - if nvim_prog:match('[/\\]') then - return funcs.fnamemodify(nvim_prog, ':p') - else - return nvim_prog - end -end - describe('Command-line option', function() describe('-s', function() local fname = 'Xtest-functional-core-main-s' diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 7851a0fcba..fd10a6afcd 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -238,6 +238,16 @@ local function stop() session:stop() end +local function nvim_prog_abs() + -- system(['build/bin/nvim']) does not work for whatever reason. It must + -- be executable searched in $PATH or something starting with / or ./. + if nvim_prog:match('[/\\]') then + return request('nvim_call_function', 'fnamemodify', {nvim_prog, ':p'}) + else + return nvim_prog + end +end + -- Executes an ex-command. VimL errors manifest as client (lua) errors, but -- v:errmsg will not be updated. local function nvim_command(cmd) @@ -826,6 +836,7 @@ local module = { nvim_async = nvim_async, nvim_dir = nvim_dir, nvim_prog = nvim_prog, + nvim_prog_abs = nvim_prog_abs, nvim_set = nvim_set, ok = ok, os_name = os_name, diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 9579e0ea0b..48fedd5927 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -3,9 +3,12 @@ local Screen = require('test.functional.ui.screen') local thelpers = require('test.functional.terminal.helpers') local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim local nvim_dir, command = helpers.nvim_dir, helpers.command +local nvim_prog_abs = helpers.nvim_prog_abs local eq, eval = helpers.eq, helpers.eval +local funcs = helpers.funcs +local nvim_set = helpers.nvim_set -describe(':terminal window highlighting', function() +describe(':terminal highlight', function() local screen before_each(function() @@ -112,8 +115,51 @@ describe(':terminal window highlighting', function() end) end) +it(':terminal highlight has lower precedence than editor #9964', function() + clear() + local screen = Screen.new(30, 4) + screen:set_default_attr_ids({ + -- "Normal" highlight emitted by the child nvim process. + N_child = {foreground = tonumber('0x4040ff'), background = tonumber('0xffff40')}, + -- "Search" highlight emitted by the child nvim process. + S_child = {background = tonumber('0xffff40'), italic = true, foreground = tonumber('0x4040ff')}, + -- "Search" highlight in the parent nvim process. + S = {background = Screen.colors.Green, italic = true, foreground = Screen.colors.Red}, + -- "Question" highlight in the parent nvim process. + Q = {background = tonumber('0xffff40'), bold = true, foreground = Screen.colors.SeaGreen4}, + }) + screen:attach({rgb=true}) + -- Child nvim process in :terminal (with cterm colors). + funcs.termopen({ + nvim_prog_abs(), '-n', '-u', 'NORC', '-i', 'NONE', '--cmd', nvim_set, + '+hi Normal ctermfg=Blue ctermbg=Yellow', + '+norm! ichild nvim', + '+norm! oline 2', + }) + screen:expect([[ + {N_child:^child nvim }| + {N_child:line 2 }| + {N_child: }| + | + ]]) + command('hi Search gui=italic guifg=Red guibg=Green cterm=italic ctermfg=Red ctermbg=Green') + feed('/nvim<cr>') + screen:expect([[ + {N_child:child }{S:^nvim}{N_child: }| + {N_child:line 2 }| + {N_child: }| + /nvim | + ]]) + command('syntax keyword Question line') + screen:expect([[ + {N_child:child }{S:^nvim}{N_child: }| + {Q:line}{N_child: 2 }| + {N_child: }| + /nvim | + ]]) +end) -describe('terminal window highlighting with custom palette', function() +describe(':terminal highlight with custom palette', function() local screen before_each(function() |