mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 19:34:15 +00:00
deps_of_all_optional: add tests proving unneeded optional deps are now also discarded
This commit is contained in:
parent
aa8a33218b
commit
bba49c5ae4
2 changed files with 20 additions and 1 deletions
|
@ -240,7 +240,7 @@ function Spec:fix_disabled()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- fix deps of plugins that are all optional
|
-- fix deps of plugins that are completely optional
|
||||||
self:fix_dependencies(all_optional_deps, dep_of, function(dep_name)
|
self:fix_dependencies(all_optional_deps, dep_of, function(dep_name)
|
||||||
self.plugins[dep_name] = nil
|
self.plugins[dep_name] = nil
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -273,6 +273,25 @@ describe("plugin spec opt", function()
|
||||||
end
|
end
|
||||||
end
|
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)
|
end)
|
||||||
|
|
||||||
describe("plugin opts", function()
|
describe("plugin opts", function()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue