aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/startup_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/core/startup_spec.lua
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/core/startup_spec.lua')
-rw-r--r--test/functional/core/startup_spec.lua100
1 files changed, 61 insertions, 39 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index cc58226f48..a53625ab1b 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -1,37 +1,41 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local assert_alive = helpers.assert_alive
-local assert_log = helpers.assert_log
-local clear = helpers.clear
-local command = helpers.command
-local ok = helpers.ok
-local eq = helpers.eq
-local matches = helpers.matches
-local eval = helpers.eval
-local exec = helpers.exec
-local exec_capture = helpers.exec_capture
-local exec_lua = helpers.exec_lua
-local feed = helpers.feed
-local fn = helpers.fn
+local assert_alive = n.assert_alive
+local assert_log = t.assert_log
+local clear = n.clear
+local command = n.command
+local ok = t.ok
+local eq = t.eq
+local matches = t.matches
+local eval = n.eval
+local exec = n.exec
+local exec_capture = n.exec_capture
+local exec_lua = n.exec_lua
+local feed = n.feed
+local fn = n.fn
local pesc = vim.pesc
-local mkdir = helpers.mkdir
-local mkdir_p = helpers.mkdir_p
-local nvim_prog = helpers.nvim_prog
-local nvim_set = helpers.nvim_set
-local read_file = helpers.read_file
-local retry = helpers.retry
-local rmdir = helpers.rmdir
+local mkdir = t.mkdir
+local mkdir_p = n.mkdir_p
+local nvim_prog = n.nvim_prog
+local nvim_set = n.nvim_set
+local read_file = t.read_file
+local retry = t.retry
+local rmdir = n.rmdir
local sleep = vim.uv.sleep
local startswith = vim.startswith
-local write_file = helpers.write_file
-local api = helpers.api
-local alter_slashes = helpers.alter_slashes
-local is_os = helpers.is_os
-local dedent = helpers.dedent
+local write_file = t.write_file
+local api = n.api
+local alter_slashes = n.alter_slashes
+local is_os = t.is_os
+local dedent = t.dedent
local tbl_map = vim.tbl_map
local tbl_filter = vim.tbl_filter
local endswith = vim.endswith
+local check_close = n.check_close
+
+local testlog = 'Xtest-startupspec-log'
describe('startup', function()
it('--clean', function()
@@ -83,6 +87,8 @@ describe('startup', function()
local screen
screen = Screen.new(60, 7)
screen:attach()
+ -- not the same colors on windows for some reason
+ screen._default_attr_ids = nil
local id = fn.termopen({
nvim_prog,
'-u',
@@ -97,15 +103,7 @@ describe('startup', function()
VIMRUNTIME = os.getenv('VIMRUNTIME'),
},
})
- screen:expect([[
- ^ |
- |
- Entering Debug mode. Type "cont" to continue. |
- nvim_exec2() |
- cmd: aunmenu * |
- > |
- |
- ]])
+ screen:expect({ any = pesc('Entering Debug mode. Type "cont" to continue.') })
fn.chansend(id, 'cont\n')
screen:expect([[
^ |
@@ -119,6 +117,11 @@ end)
describe('startup', function()
before_each(clear)
+ after_each(function()
+ check_close()
+ os.remove(testlog)
+ end)
+
describe('-l Lua', function()
local function assert_l_out(expected, nvim_args, lua_args, script, input)
local args = { nvim_prog }
@@ -326,6 +329,9 @@ describe('startup', function()
local screen = Screen.new(25, 3)
-- Remote UI connected by --embed.
screen:attach()
+ -- TODO: a lot of tests in this file already use the new default color scheme.
+ -- once we do the batch update of tests to use it, remove this workarond
+ screen._default_attr_ids = nil
command([[echo has('ttyin') has('ttyout')]])
screen:expect([[
^ |
@@ -337,6 +343,7 @@ describe('startup', function()
it('in a TTY: has("ttyin")==1 has("ttyout")==1', function()
local screen = Screen.new(25, 4)
screen:attach()
+ screen._default_attr_ids = nil
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
@@ -365,6 +372,7 @@ describe('startup', function()
end)
it('output to pipe: has("ttyin")==1 has("ttyout")==0', function()
+ clear({ env = { NVIM_LOG_FILE = testlog } })
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
@@ -392,9 +400,13 @@ describe('startup', function()
read_file('Xtest_startup_ttyout')
)
end)
+ if is_os('win') then
+ assert_log('stream write failed. RPC canceled; closing channel', testlog)
+ end
end)
it('input from pipe: has("ttyin")==0 has("ttyout")==1', function()
+ clear({ env = { NVIM_LOG_FILE = testlog } })
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
@@ -423,11 +435,16 @@ describe('startup', function()
read_file('Xtest_startup_ttyout')
)
end)
+ if is_os('win') then
+ assert_log('stream write failed. RPC canceled; closing channel', testlog)
+ end
end)
it('input from pipe (implicit) #7679', function()
+ clear({ env = { NVIM_LOG_FILE = testlog } })
local screen = Screen.new(25, 4)
screen:attach()
+ screen._default_attr_ids = nil
if is_os('win') then
command([[set shellcmdflag=/s\ /c shellxquote=\"]])
end
@@ -450,6 +467,9 @@ describe('startup', function()
0 1 |
|
]])
+ if not is_os('win') then
+ assert_log('Failed to get flags on descriptor 3: Bad file descriptor', testlog, 100)
+ end
end)
it('input from pipe + file args #7679', function()
@@ -589,6 +609,7 @@ describe('startup', function()
local screen
screen = Screen.new(60, 6)
screen:attach()
+ screen._default_attr_ids = nil
local id = fn.termopen({
nvim_prog,
'-u',
@@ -974,7 +995,7 @@ describe('sysinit', function()
local xdgdir = 'Xxdg'
local vimdir = 'Xvim'
local xhome = 'Xhome'
- local pathsep = helpers.get_pathsep()
+ local pathsep = n.get_pathsep()
before_each(function()
rmdir(xdgdir)
@@ -1035,7 +1056,7 @@ end)
describe('user config init', function()
local xhome = 'Xhome'
- local pathsep = helpers.get_pathsep()
+ local pathsep = n.get_pathsep()
local xconfig = xhome .. pathsep .. 'Xconfig'
local xdata = xhome .. pathsep .. 'Xdata'
local init_lua_path = table.concat({ xconfig, 'nvim', 'init.lua' }, pathsep)
@@ -1123,6 +1144,7 @@ describe('user config init', function()
local screen = Screen.new(50, 8)
screen:attach()
+ screen._default_attr_ids = nil
fn.termopen({ nvim_prog }, {
env = {
VIMRUNTIME = os.getenv('VIMRUNTIME'),
@@ -1197,7 +1219,7 @@ end)
describe('runtime:', function()
local xhome = 'Xhome'
- local pathsep = helpers.get_pathsep()
+ local pathsep = n.get_pathsep()
local xconfig = xhome .. pathsep .. 'Xconfig'
local xdata = xhome .. pathsep .. 'Xdata'
local xenv = { XDG_CONFIG_HOME = xconfig, XDG_DATA_HOME = xdata }
@@ -1339,7 +1361,7 @@ end)
describe('user session', function()
local xhome = 'Xhome'
- local pathsep = helpers.get_pathsep()
+ local pathsep = n.get_pathsep()
local session_file = table.concat({ xhome, 'session.lua' }, pathsep)
before_each(function()