aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/helpers.lua
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-12-05 14:26:46 -0800
committerGregory Anders <greg@gpanders.com>2023-12-06 10:38:44 -0800
commita5a346678a8211ea07f318de42e557ad3909f65e (patch)
tree7582752e1e60dbe8accd0e22ecedd2d814fe525f /test/functional/terminal/helpers.lua
parent2613ba5000d4c0d9b15e2eec2d2b97615575925e (diff)
downloadrneovim-a5a346678a8211ea07f318de42e557ad3909f65e.tar.gz
rneovim-a5a346678a8211ea07f318de42e557ad3909f65e.tar.bz2
rneovim-a5a346678a8211ea07f318de42e557ad3909f65e.zip
test: set notermguicolors in tests
Set 'notermguicolors' in tests which spawn a child Nvim process to force existing tests to use 16 colors. Also refactor the child process invocation to make things a little bit less messy.
Diffstat (limited to 'test/functional/terminal/helpers.lua')
-rw-r--r--test/functional/terminal/helpers.lua24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua
index 62d3dd67a3..4ae054daa8 100644
--- a/test/functional/terminal/helpers.lua
+++ b/test/functional/terminal/helpers.lua
@@ -6,6 +6,7 @@ local Screen = require('test.functional.ui.screen')
local testprg = helpers.testprg
local exec_lua = helpers.exec_lua
local nvim = helpers.nvim
+local nvim_prog = helpers.nvim_prog
local function feed_data(data)
if type(data) == 'table' then
@@ -122,6 +123,26 @@ local function screen_setup(extra_rows, command, cols, opts)
return screen
end
+local function setup_child_nvim(args, opts)
+ opts = opts or {}
+
+ local argv = { nvim_prog, unpack(args) }
+ local cmd = string.format('[%s]', vim.iter(argv):map(function(s)
+ return string.format('\'%s\'', s)
+ end):join(', '))
+
+ if opts.env then
+ local s = {}
+ for k, v in pairs(opts.env) do
+ table.insert(s, string.format('%s: \'%s\'', k, v))
+ end
+
+ cmd = string.format('%s, #{env: #{%s}}', cmd, table.concat(s, ', '))
+ end
+
+ return screen_setup(0, cmd, opts.cols)
+end
+
return {
feed_data = feed_data,
feed_termcode = feed_termcode,
@@ -141,5 +162,6 @@ return {
clear_attrs = clear_attrs,
enable_mouse = enable_mouse,
disable_mouse = disable_mouse,
- screen_setup = screen_setup
+ screen_setup = screen_setup,
+ setup_child_nvim = setup_child_nvim,
}