mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
test: cleanup ftplugin_spec.lua #32948
Problem: - cannot run ftplugin_spec.lua by itself - test leaves foo/ dir Solution: - fix setup and teardown
This commit is contained in:
@@ -3,18 +3,12 @@ local M = {}
|
||||
--- @param module string
|
||||
---@return string
|
||||
function M.includeexpr(module)
|
||||
---@param fname string
|
||||
---@return boolean
|
||||
local function filereadable(fname)
|
||||
return vim.fn.filereadable(fname) == 1
|
||||
end
|
||||
|
||||
local fname = module:gsub('%.', '/')
|
||||
|
||||
local root = vim.fs.root(vim.api.nvim_buf_get_name(0), 'lua') or vim.fn.getcwd()
|
||||
for _, suf in ipairs { '.lua', '/init.lua' } do
|
||||
local path = vim.fs.joinpath(root, 'lua', fname .. suf)
|
||||
if filereadable(path) then
|
||||
if vim.uv.fs_stat(path) then
|
||||
return path
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user