aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/commands_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-29 09:23:31 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-29 09:39:55 +0800
commit7b6d041baed712b071acfa8bb71727a5f5e27561 (patch)
tree2844deffee1f539d8bf933654dda276bcb55bc9c /test/functional/lua/commands_spec.lua
parent2eb1f62e29c54fe4d3cebcff388ea6c239313980 (diff)
downloadrneovim-7b6d041baed712b071acfa8bb71727a5f5e27561.tar.gz
rneovim-7b6d041baed712b071acfa8bb71727a5f5e27561.tar.bz2
rneovim-7b6d041baed712b071acfa8bb71727a5f5e27561.zip
fix(heredoc): allow missing end marker for scripts
Also do not crash when getting heredoc fails.
Diffstat (limited to 'test/functional/lua/commands_spec.lua')
-rw-r--r--test/functional/lua/commands_spec.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua
index 5bb9e0281b..0dc6c19fa1 100644
--- a/test/functional/lua/commands_spec.lua
+++ b/test/functional/lua/commands_spec.lua
@@ -7,6 +7,7 @@ local NIL = helpers.NIL
local eval = helpers.eval
local feed = helpers.feed
local clear = helpers.clear
+local matches = helpers.matches
local meths = helpers.meths
local exec_lua = helpers.exec_lua
local exec_capture = helpers.exec_capture
@@ -27,22 +28,27 @@ describe(':lua command', function()
eq('', exec_capture(
'lua vim.api.nvim_buf_set_lines(1, 1, 2, false, {"TEST"})'))
eq({'', 'TEST'}, curbufmeths.get_lines(0, 100, false))
- source(dedent([[
+ source([[
lua << EOF
vim.api.nvim_buf_set_lines(1, 1, 2, false, {"TSET"})
- EOF]]))
+ EOF]])
eq({'', 'TSET'}, curbufmeths.get_lines(0, 100, false))
- source(dedent([[
+ source([[
lua << EOF
- vim.api.nvim_buf_set_lines(1, 1, 2, false, {"SETT"})]]))
+ vim.api.nvim_buf_set_lines(1, 1, 2, false, {"SETT"})]])
eq({'', 'SETT'}, curbufmeths.get_lines(0, 100, false))
- source(dedent([[
+ source([[
lua << EOF
vim.api.nvim_buf_set_lines(1, 1, 2, false, {"ETTS"})
vim.api.nvim_buf_set_lines(1, 2, 3, false, {"TTSE"})
vim.api.nvim_buf_set_lines(1, 3, 4, false, {"STTE"})
- EOF]]))
+ EOF]])
eq({'', 'ETTS', 'TTSE', 'STTE'}, curbufmeths.get_lines(0, 100, false))
+ matches('.*Vim%(lua%):E15: Invalid expression: .*', pcall_err(source, [[
+ lua << eval EOF
+ {}
+ EOF
+ ]]))
end)
it('throws catchable errors', function()
eq([[Vim(lua):E5107: Error loading lua [string ":lua"]:0: unexpected symbol near ')']],