Problem: plenary.nvim is deprecated. The test suite depends on plenary's async test runner and coroutine-based utilities, tying the project to an unmaintained dependency. CI also tests against Neovim 0.8-0.11, which are no longer relevant. Solution: replace plenary with busted + nlua (nvim -l). Convert all async test patterns (a.wrap, a.util.sleep, a.util.scheduler) to synchronous equivalents using vim.wait. Rename tests/ to spec/ to follow busted convention. Replace the CI test matrix with nvim-busted-action targeting stable/nightly only. Add .busted config, luarocks test_dependencies, and update the nix devshell.
40 lines
1.2 KiB
Lua
40 lines
1.2 KiB
Lua
local TmpDir = require('spec.tmpdir')
|
|
local oil = require('oil')
|
|
local test_util = require('spec.test_util')
|
|
local util = require('oil.util')
|
|
|
|
describe('oil preview', function()
|
|
local tmpdir
|
|
before_each(function()
|
|
tmpdir = TmpDir.new()
|
|
end)
|
|
after_each(function()
|
|
if tmpdir then
|
|
tmpdir:dispose()
|
|
end
|
|
test_util.reset_editor()
|
|
end)
|
|
|
|
it('opens preview window', function()
|
|
tmpdir:create({ 'a.txt' })
|
|
test_util.oil_open(tmpdir.path)
|
|
test_util.await(oil.open_preview, 2)
|
|
local preview_win = util.get_preview_win()
|
|
assert.not_nil(preview_win)
|
|
assert(preview_win)
|
|
local bufnr = vim.api.nvim_win_get_buf(preview_win)
|
|
local preview_lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
|
assert.are.same({ 'a.txt' }, preview_lines)
|
|
end)
|
|
|
|
it('opens preview window when open(preview={})', function()
|
|
tmpdir:create({ 'a.txt' })
|
|
test_util.oil_open(tmpdir.path, { preview = {} })
|
|
local preview_win = util.get_preview_win()
|
|
assert.not_nil(preview_win)
|
|
assert(preview_win)
|
|
local bufnr = vim.api.nvim_win_get_buf(preview_win)
|
|
local preview_lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
|
assert.are.same({ 'a.txt' }, preview_lines)
|
|
end)
|
|
end)
|