From 20d127551d05f601e655bee44e1a1e5b0bd0cee0 Mon Sep 17 00:00:00 2001 From: Oula Kuuva Date: Sat, 6 Jun 2026 17:03:18 +0300 Subject: [PATCH] test: add support for standalone mini.icons --- tests/minimal_init.lua | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/minimal_init.lua b/tests/minimal_init.lua index 325db01..37bae5d 100644 --- a/tests/minimal_init.lua +++ b/tests/minimal_init.lua @@ -1,11 +1,26 @@ ---@param name string +---@param optional? boolean ---@return string -local function get_path(name) +local function get_path(name, optional) local paths = vim.fs.find(name, { path = vim.fn.stdpath('data') }) - assert(#paths == 1, 'plugin must have one path') + if not optional then + assert(#paths == 1, 'plugin must have one path') + end return paths[1] end +---@param names string[] +---@return string +local function get_first_path(names) + for _, name in ipairs(names) do + local path = get_path(name, true) + if path then + return path + end + end + error(table.concat(names, ' or ') .. ' must be installed') +end + -- settings vim.o.columns = 80 vim.o.lines = 40 @@ -15,7 +30,7 @@ vim.o.wrap = false -- source dependencies first vim.opt.rtp:prepend(get_path('nvim-treesitter')) vim.cmd.runtime('plugin/nvim-treesitter.lua') -vim.opt.rtp:prepend(get_path('mini.nvim')) +vim.opt.rtp:prepend(get_first_path({ 'mini.icons', 'mini.nvim' })) -- source this plugin vim.opt.rtp:prepend('.')