aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-01-02 15:34:14 +0100
committerJustin M. Keyes <justinkz@gmail.com>2023-01-05 17:10:02 +0100
commitadef308a5925a3b967af3bd7c598074e5b6cae18 (patch)
tree10bb0dc4b3801eb53b56023542283c20aff7e967 /test/functional/core
parent45549f031ee52a01601c33acc411f3111cfc4e95 (diff)
downloadrneovim-adef308a5925a3b967af3bd7c598074e5b6cae18.tar.gz
rneovim-adef308a5925a3b967af3bd7c598074e5b6cae18.tar.bz2
rneovim-adef308a5925a3b967af3bd7c598074e5b6cae18.zip
feat(lua): exit 1 on Lua "-l" script error
Diffstat (limited to 'test/functional/core')
-rw-r--r--test/functional/core/startup_spec.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index dbd517995c..455de08548 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -88,11 +88,11 @@ describe('startup', function()
end)
describe('-l Lua', function()
- local function assert_l_out(expected, args_before, args_after)
+ local function assert_l_out(expected, nvim_args, lua_args)
local args = { nvim_prog, '--clean' }
- vim.list_extend(args, args_before or {})
+ vim.list_extend(args, nvim_args or {})
vim.list_extend(args, { '-l', 'test/functional/fixtures/startup.lua' })
- vim.list_extend(args, args_after or {})
+ vim.list_extend(args, lua_args or {})
local out = funcs.system(args):gsub('\r\n', '\n')
return eq(dedent(expected), out)
end
@@ -115,6 +115,13 @@ describe('startup', function()
eq(73, eval('v:shell_error'))
end)
+ it('Lua error sets Nvim exitcode', function()
+ eq(0, eval('v:shell_error'))
+ matches('E5113: .* my pearls!!',
+ funcs.system({ nvim_prog, '-l', 'test/functional/fixtures/startup-fail.lua' }))
+ eq(1, eval('v:shell_error'))
+ end)
+
it('sets _G.arg', function()
-- nvim -l foo.lua -arg1 -- a b c
assert_l_out([[
@@ -396,11 +403,13 @@ describe('startup', function()
{ 'put =mode(1)', 'print', '' }))
end)
- it('fails on --embed with -es/-Es', function()
- matches('nvim[.exe]*: %-%-embed conflicts with %-es/%-Es',
+ it('fails on --embed with -es/-Es/-l', function()
+ matches('nvim[.exe]*: %-%-embed conflicts with %-es/%-Es/%-l',
funcs.system({nvim_prog, '--embed', '-es' }))
- matches('nvim[.exe]*: %-%-embed conflicts with %-es/%-Es',
+ matches('nvim[.exe]*: %-%-embed conflicts with %-es/%-Es/%-l',
funcs.system({nvim_prog, '--embed', '-Es' }))
+ matches('nvim[.exe]*: %-%-embed conflicts with %-es/%-Es/%-l',
+ funcs.system({nvim_prog, '--embed', '-l', 'foo.lua' }))
end)
it('does not crash if --embed is given twice', function()