aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/eval_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-25 08:23:24 +0800
committerGitHub <noreply@github.com>2023-09-25 08:23:24 +0800
commit9e7c4fe5791559ff2c9ffe6329f1d7e2150385ed (patch)
treed0315ad50f1bcf30eb66c118114ac797611d3d4b /test/functional/vimscript/eval_spec.lua
parent8195c180065a7f477b63f0eb4e5edb890adba0c5 (diff)
downloadrneovim-9e7c4fe5791559ff2c9ffe6329f1d7e2150385ed.tar.gz
rneovim-9e7c4fe5791559ff2c9ffe6329f1d7e2150385ed.tar.bz2
rneovim-9e7c4fe5791559ff2c9ffe6329f1d7e2150385ed.zip
fix(exception): remember whether message is multiline (#25351)
Diffstat (limited to 'test/functional/vimscript/eval_spec.lua')
-rw-r--r--test/functional/vimscript/eval_spec.lua40
1 files changed, 35 insertions, 5 deletions
diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua
index b3f2c1bfeb..ab0ffccd4d 100644
--- a/test/functional/vimscript/eval_spec.lua
+++ b/test/functional/vimscript/eval_spec.lua
@@ -153,11 +153,6 @@ end)
describe("uncaught exception", function()
before_each(clear)
- after_each(function()
- os.remove('throw1.vim')
- os.remove('throw2.vim')
- os.remove('throw3.vim')
- end)
it('is not forgotten #13490', function()
command('autocmd BufWinEnter * throw "i am error"')
@@ -173,10 +168,45 @@ describe("uncaught exception", function()
let result ..= 'X'
]]):format(i, i))
end
+ finally(function()
+ for i = 1, 3 do
+ os.remove('throw' .. i .. '.vim')
+ end
+ end)
+
command('set runtimepath+=. | let result = ""')
eq('throw1', exc_exec('try | runtime! throw*.vim | endtry'))
eq('123', eval('result'))
end)
+
+ it('multiline exception remains multiline #25350', function()
+ local screen = Screen.new(80, 11)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, reverse = true}; -- MsgSeparator
+ [2] = {foreground = Screen.colors.White, background = Screen.colors.Red}; -- ErrorMsg
+ [3] = {bold = true, foreground = Screen.colors.SeaGreen}; -- MoreMsg
+ })
+ screen:attach()
+ exec_lua([[
+ function _G.Oops()
+ error("oops")
+ end
+ ]])
+ feed(':try\rlua _G.Oops()\rendtry\r')
+ screen:expect{grid=[[
+ {1: }|
+ :try |
+ : lua _G.Oops() |
+ : endtry |
+ {2:Error detected while processing :} |
+ {2:E5108: Error executing lua [string "<nvim>"]:2: oops} |
+ {2:stack traceback:} |
+ {2: [C]: in function 'error'} |
+ {2: [string "<nvim>"]:2: in function 'Oops'} |
+ {2: [string ":lua"]:1: in main chunk} |
+ {3:Press ENTER or type command to continue}^ |
+ ]]}
+ end)
end)
describe('listing functions using :function', function()