style: cleanup

This commit is contained in:
Folke Lemaitre 2022-11-30 23:14:16 +01:00
parent a197f751f9
commit a87b6e1005
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
5 changed files with 39 additions and 21 deletions

View file

@ -30,7 +30,7 @@ end)
describe("plugin spec opt", function()
it("handles dependencies", function()
Config.options.opt = false
Config.options.defaults.opt = false
local tests = {
{ "foo/bar", dependencies = { "foo/dep1", "foo/dep2" } },
{ "foo/bar", dependencies = { { "foo/dep1" }, "foo/dep2" } },
@ -52,7 +52,7 @@ describe("plugin spec opt", function()
end)
it("handles opt from dep", function()
Config.options.opt = false
Config.options.defaults.opt = false
local spec = Plugin.Spec.new({ "foo/dep1", { "foo/bar", dependencies = { "foo/dep1", "foo/dep2" } } })
Config.plugins = spec.plugins
Plugin.update_state()
@ -65,8 +65,25 @@ describe("plugin spec opt", function()
assert(spec.plugins.dep1.opt == false)
end)
it("handles defaults opt", function()
do
Config.options.defaults.opt = true
local spec = Plugin.Spec.new({ "foo/bar" })
Config.plugins = spec.plugins
Plugin.update_state()
assert(spec.plugins.bar.opt == true)
end
do
Config.options.defaults.opt = false
local spec = Plugin.Spec.new({ "foo/bar" })
Config.plugins = spec.plugins
Plugin.update_state()
assert(spec.plugins.bar.opt == false)
end
end)
it("handles opt from dep", function()
Config.options.opt = false
Config.options.defaults.opt = false
local spec = Plugin.Spec.new({ "foo/bar", module = "foo" })
Config.plugins = spec.plugins
Plugin.update_state()