aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-26 15:33:11 +0800
committerGitHub <noreply@github.com>2025-02-26 07:33:11 +0000
commitb0a1d35f69b4cd94c46cf957ef45e4d239b0295e (patch)
treedfd317382cdbc5f253bcad4586fff67e263a4803 /test
parentf4bb7417b7f52e09bd29750d753b4cbe3b225a82 (diff)
downloadrneovim-b0a1d35f69b4cd94c46cf957ef45e4d239b0295e.tar.gz
rneovim-b0a1d35f69b4cd94c46cf957ef45e4d239b0295e.tar.bz2
rneovim-b0a1d35f69b4cd94c46cf957ef45e4d239b0295e.zip
fix(eval): don't shorten $HOME in v:stacktrace (#32634)
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/source_spec.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua
index 40225784f5..dba158962f 100644
--- a/test/functional/ex_cmds/source_spec.lua
+++ b/test/functional/ex_cmds/source_spec.lua
@@ -292,3 +292,29 @@ describe(':source', function()
os.remove(test_file)
end)
end)
+
+it('$HOME is not shortened in filepath in v:stacktrace from sourced file', function()
+ local sep = n.get_pathsep()
+ local xhome = table.concat({ vim.uv.cwd(), 'Xhome' }, sep)
+ mkdir(xhome)
+ clear({ env = { HOME = xhome } })
+ finally(function()
+ rmdir(xhome)
+ end)
+ local filepath = table.concat({ xhome, 'Xstacktrace.vim' }, sep)
+ local script = [[
+ func Xfunc()
+ throw 'Exception from Xfunc'
+ endfunc
+ ]]
+ write_file(filepath, script)
+ exec('source ' .. filepath)
+ exec([[
+ try
+ call Xfunc()
+ catch
+ let g:stacktrace = v:stacktrace
+ endtry
+ ]])
+ eq(filepath, n.eval('g:stacktrace[-1].filepath'))
+end)