From 6c3ddd8c510a28d4acb777b9676a0d4137b309fa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 7 Dec 2023 10:16:00 +0800 Subject: test: set 'termguicolors' in outer Nvim instance (#26437) Currently, the value of $COLORTERM in :terminal in tests depends on outer environment because of 'notermguicolors'. If $COLORTERM is not set in :terminal, an inner Nvim instance will try to detect 'termguicolors' support, which may interfere with tests. So set 'termguicolors' in outer Nvim instance unless $COLORTERM needs to be overridden, and unset it in inner Nvim instance when running TUI. --- test/functional/helpers.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test/functional/helpers.lua') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 5780d0a978..7ec67a2cb3 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -28,17 +28,18 @@ module.nvim_prog = ( ) -- Default settings for the test session. module.nvim_set = ( - 'set shortmess+=IS background=light noswapfile noautoindent startofline' + 'set shortmess+=IS background=light termguicolors noswapfile noautoindent startofline' ..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.' - ..' belloff= wildoptions-=pum joinspaces noshowcmd noruler nomore redrawdebug=invalid' - ..' notermguicolors') + ..' belloff= wildoptions-=pum joinspaces noshowcmd noruler nomore redrawdebug=invalid') module.nvim_argv = { module.nvim_prog, '-u', 'NONE', '-i', 'NONE', -- XXX: find treesitter parsers. '--cmd', runtime_set, '--cmd', module.nvim_set, - '--cmd', 'mapclear', - '--cmd', 'mapclear!', + -- Remove default mappings. + '--cmd', 'mapclear | mapclear!', + -- Unset $COLORTERM so that it won't propagate to :terminal when 'notermguicolors'. + '--cmd', 'unlet $COLORTERM', -- Make screentest work after changing to the new default color scheme -- Source 'vim' color scheme without side effects -- TODO: rewrite tests -- cgit