test(exrc): lua exrc knows its location #34713

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
(cherry picked from commit 99873296be)
This commit is contained in:
Yochem van Rosmalen
2025-07-01 12:51:48 +02:00
committed by Justin M. Keyes
parent 7b2119dbd9
commit 41ceefe804

View File

@ -1140,6 +1140,7 @@ describe('user config init', function()
string.format(
[[
vim.g.exrc_file = "%s"
vim.g.exrc_path = debug.getinfo(1, 'S').source:sub(2)
]],
exrc_path
)
@ -1150,6 +1151,7 @@ describe('user config init', function()
string.format(
[[
let g:exrc_file = "%s"
" let g:exrc_path = ??
]],
exrc_path
)
@ -1213,6 +1215,12 @@ describe('user config init', function()
))
clear { args_rm = { '-u' }, env = xstateenv }
if string.find(exrc_path, '%.lua$') then
eq(
vim.fs.normalize(vim.fs.abspath(filename)),
vim.fs.normalize(vim.fs.abspath(eval('g:exrc_path')))
)
end
-- The 'exrc' file is now trusted.
eq(filename, eval('g:exrc_file'))
end)