diff --git a/tests/init.lua b/tests/init.lua index dbb1e1f..6033882 100644 --- a/tests/init.lua +++ b/tests/init.lua @@ -1,15 +1,19 @@ local M = {} +---@param root string? +---@return string function M.root(root) local f = debug.getinfo(1, "S").source:sub(2) - return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (root or "") + f = vim.fn.fnamemodify(f, ":p:h:h") + if root then f = f .. "/" .. root end + return f end ---@param plugin string function M.load(plugin) local name = plugin:match(".*/(.*)") local package_root = M.root(".tests/site/pack/deps/start/") - if not vim.loop.fs_stat(package_root .. name) then + if not vim.uv.fs_stat(package_root .. name) then print("Installing " .. plugin) vim.fn.mkdir(package_root, "p") vim.fn.system({ @@ -23,7 +27,6 @@ function M.load(plugin) end function M.setup() - vim.cmd([[set runtimepath=$VIMRUNTIME]]) vim.opt.runtimepath:append(M.root()) vim.opt.packpath = { M.root(".tests/site") } M.load("nvim-lua/plenary.nvim")