fix: renaming buffers doesn't interfere with directory hijack (#25)

This commit is contained in:
Steven Arcangeli 2023-01-10 22:08:59 -08:00
parent 80f64dd630
commit b4ccc16944
3 changed files with 45 additions and 15 deletions

20
tests/regression_spec.lua Normal file
View file

@ -0,0 +1,20 @@
require("plenary.async").tests.add_to_env()
local test_util = require("tests.test_util")
a.describe("regression tests", function()
after_each(function()
test_util.reset_editor()
end)
-- see https://github.com/stevearc/oil.nvim/issues/25
a.it("can edit dirs that will be renamed to an existing buffer", function()
vim.cmd.edit({ args = { "README.md" } })
vim.cmd.vsplit()
vim.cmd.edit({ args = { "%:p:h" } })
assert.equals("oil", vim.bo.filetype)
vim.cmd.wincmd({ args = { "p" } })
assert.equals("markdown", vim.bo.filetype)
vim.cmd.edit({ args = { "%:p:h" } })
a.util.sleep(10)
assert.equals("oil", vim.bo.filetype)
end)
end)