mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
feat(plugins): Given an optional plugin, conditionally discard deps (#947)
* deps_of_all_optional: First, refactor the code responsible for disabling unneeded deps to be more generic * deps_of_all_optional: Second, also disable unneeded deps from plugins marked as all optional * deps_of_all_optional: add tests proving unneeded optional deps are now also discarded * deps_of_all_optional: forgot return type --------- Co-authored-by: abeldekat <abel@nomail.com>
This commit is contained in:
parent
af4d24b8d0
commit
e7334d8db5
2 changed files with 65 additions and 24 deletions
|
@ -273,6 +273,25 @@ describe("plugin spec opt", function()
|
|||
end
|
||||
end
|
||||
end)
|
||||
|
||||
it("handles the optional keyword", function()
|
||||
local tests = {
|
||||
[{ { "foo/bax" }, { "foo/bar", optional = true, dependencies = "foo/dep1" } }] = false,
|
||||
[{ { "foo/bax", dependencies = "foo/dep1" }, { "foo/bar", optional = true, dependencies = "foo/dep1" } }] = true,
|
||||
}
|
||||
for test, ret in pairs(tests) do
|
||||
local spec = Plugin.Spec.new(test)
|
||||
assert(#spec.notifs == 0)
|
||||
assert(spec.plugins.bax)
|
||||
assert(not spec.plugins.bar)
|
||||
assert(#spec.disabled == 0)
|
||||
if ret then
|
||||
assert(spec.plugins.dep1)
|
||||
else
|
||||
assert(not spec.plugins.opt1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("plugin opts", function()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue