aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/startup_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/core/startup_spec.lua')
-rw-r--r--test/functional/core/startup_spec.lua39
1 files changed, 31 insertions, 8 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 642e2b0287..8ecd3dca97 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -136,7 +136,11 @@ describe('startup', function()
vim.list_extend(args, { '-l', (script or 'test/functional/fixtures/startup.lua') })
vim.list_extend(args, lua_args or {})
local out = fn.system(args, input):gsub('\r\n', '\n')
- return eq(dedent(expected), out)
+ if type(expected) == 'function' then
+ return expected(out)
+ else
+ return eq(dedent(expected), out)
+ end
end
it('failure modes', function()
@@ -172,6 +176,7 @@ describe('startup', function()
it('Lua-error sets Nvim exitcode', function()
local proc = n.spawn_wait('-l', 'test/functional/fixtures/startup-fail.lua')
matches('E5113: .* my pearls!!', proc:output())
+ eq(0, proc.signal)
eq(1, proc.status)
eq(0, eval('v:shell_error'))
@@ -282,14 +287,30 @@ describe('startup', function()
eq(0, eval('v:shell_error'))
end)
- it('disables swapfile/shada/config/plugins', function()
+ it('disables swapfile/shada/config/plugins unless overridden', function()
+ local script = [[print(('updatecount=%d shadafile=%s loadplugins=%s scripts=%d'):format(
+ vim.o.updatecount, vim.o.shadafile, tostring(vim.o.loadplugins), math.max(1, #vim.fn.getscriptinfo())))]]
+ finally(function()
+ os.remove('Xtest_shada')
+ end)
+
assert_l_out(
'updatecount=0 shadafile=NONE loadplugins=false scripts=1\n',
nil,
nil,
'-',
- [[print(('updatecount=%d shadafile=%s loadplugins=%s scripts=%d'):format(
- vim.o.updatecount, vim.o.shadafile, tostring(vim.o.loadplugins), math.max(1, #vim.fn.getscriptinfo())))]]
+ script
+ )
+
+ -- User can override.
+ assert_l_out(
+ function(out)
+ return matches('updatecount=99 shadafile=Xtest_shada loadplugins=true scripts=2%d\n', out)
+ end,
+ { '+set updatecount=99', '-i', 'Xtest_shada', '+set loadplugins', '-u', 'NORC' },
+ nil,
+ '-',
+ script
)
end)
end)
@@ -572,19 +593,21 @@ describe('startup', function()
eq(' encoding=utf-8\n', fn.system({ nvim_prog, '-n', '-es' }, { 'set encoding', '' }))
end)
- it('-es/-Es disables swapfile, user config #8540', function()
+ it('-es/-Es disables swapfile/shada/config #8540', function()
for _, arg in ipairs({ '-es', '-Es' }) do
local out = fn.system({
nvim_prog,
arg,
- '+set swapfile? updatecount? shadafile?',
+ '+set updatecount? shadafile? loadplugins?',
'+put =map(getscriptinfo(), {-> v:val.name})',
'+%print',
})
local line1 = string.match(out, '^.-\n')
-- updatecount=0 means swapfile was disabled.
- eq(' swapfile updatecount=0 shadafile=\n', line1)
- -- Standard plugins were loaded, but not user config.
+ eq(' updatecount=0 shadafile=NONE loadplugins\n', line1)
+ -- Standard plugins were loaded, but not user config. #31878
+ local nrlines = #vim.split(out, '\n')
+ ok(nrlines > 20, '>20', nrlines)
ok(string.find(out, 'man.lua') ~= nil)
ok(string.find(out, 'init.vim') == nil)
end