commit 99873296beb4a868d7a2ac63d80bcaa206ff1d36
parent 66f02ee1fea2cf3c033e48e58bd49e8b81c7a11e
Author: Yochem van Rosmalen <git@yochem.nl>
Date: Tue, 1 Jul 2025 12:51:48 +0200
test(exrc): lua exrc knows its location #34713
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
@@ -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)
vim.g.exrc_count = (vim.g.exrc_count or 0) + 1
]],
exrc_path
@@ -1151,6 +1152,7 @@ describe('user config init', function()
string.format(
[[
let g:exrc_file = "%s"
+ " let g:exrc_path = ??
let g:exrc_count = get(g:, 'exrc_count', 0) + 1
]],
exrc_path
@@ -1222,6 +1224,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)