Skip to content

Commit a5b71e2

Browse files
authored
test: add support for standalone mini.icons (#666)
1 parent ae8e75f commit a5b71e2

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

tests/minimal_init.lua

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
---@param name string
2+
---@param optional? boolean
23
---@return string
3-
local function get_path(name)
4+
local function get_path(name, optional)
45
local paths = vim.fs.find(name, { path = vim.fn.stdpath('data') })
5-
assert(#paths == 1, 'plugin must have one path')
6+
if not optional then
7+
assert(#paths == 1, 'plugin must have one path')
8+
end
69
return paths[1]
710
end
811

12+
---@param names string[]
13+
---@return string
14+
local function get_first_path(names)
15+
for _, name in ipairs(names) do
16+
local path = get_path(name, true)
17+
if path then
18+
return path
19+
end
20+
end
21+
error(table.concat(names, ' or ') .. ' must be installed')
22+
end
23+
924
-- settings
1025
vim.o.columns = 80
1126
vim.o.lines = 40
@@ -15,7 +30,7 @@ vim.o.wrap = false
1530
-- source dependencies first
1631
vim.opt.rtp:prepend(get_path('nvim-treesitter'))
1732
vim.cmd.runtime('plugin/nvim-treesitter.lua')
18-
vim.opt.rtp:prepend(get_path('mini.nvim'))
33+
vim.opt.rtp:prepend(get_first_path({ 'mini.icons', 'mini.nvim' }))
1934

2035
-- source this plugin
2136
vim.opt.rtp:prepend('.')

0 commit comments

Comments
 (0)