canola.nvim/tests/config_spec.lua
Barrett Ruth 856716e6dc
feat: support vim.g.oil configuration + remove release-please (#17)
* feat: support vim.g.oil declarative configuration

Problem: oil.nvim requires an imperative require("oil").setup(opts)
call to initialize. The Neovim ecosystem is moving toward vim.g.plugin
as a declarative config source that works without explicit setup calls.

Solution: fall back to vim.g.oil in config.setup() when no opts are
passed, and add plugin/oil.lua to auto-initialize when vim.g.oil is
set. Explicit setup(opts) calls still take precedence. Update docs
and add tests for the new resolution order.

Closes: barrettruth/oil.nvim#1

* build: remove release-please pipeline

Problem: the release-please action creates automated releases that
are not needed for this fork's workflow.

Solution: remove the release job from tests.yml and the
release-please branch exclusion from the review request workflow.

* fix(doc): improve readme phrasing

* doc: minor phrasing "improvements"

* ci: add luarocks release on tag push

Problem: there is no automated way to publish oil.nvim to luarocks
when a new version is tagged.

Solution: add a luarocks workflow that triggers on v* tag pushes,
runs the test suite via workflow_call, then publishes via
luarocks-tag-release. Add workflow_call trigger to tests.yml so it
can be reused.
2026-02-21 22:38:38 -05:00

27 lines
799 B
Lua

local config = require("oil.config")
describe("config", function()
after_each(function()
vim.g.oil = nil
end)
it("falls back to vim.g.oil when setup() is called with no args", function()
vim.g.oil = { delete_to_trash = true, cleanup_delay_ms = 5000 }
config.setup()
assert.is_true(config.delete_to_trash)
assert.equals(5000, config.cleanup_delay_ms)
end)
it("uses defaults when neither opts nor vim.g.oil is set", function()
vim.g.oil = nil
config.setup()
assert.is_false(config.delete_to_trash)
assert.equals(2000, config.cleanup_delay_ms)
end)
it("prefers explicit opts over vim.g.oil", function()
vim.g.oil = { delete_to_trash = true }
config.setup({ delete_to_trash = false })
assert.is_false(config.delete_to_trash)
end)
end)