test(nvim): cover nested worktree resolution
This commit is contained in:
@@ -245,6 +245,19 @@ describe('func.worktree', function()
|
||||
assert.same({ 2, 1 }, worktree.clamp_cursor(buf, { 2, 1 }))
|
||||
end)
|
||||
|
||||
it('carries a buffer from the innermost worktree containing it', function()
|
||||
local nested = main .. '/nested'
|
||||
sh({ 'git', '-C', main, 'worktree', 'add', '-q', '-b', 'nested', nested })
|
||||
open(nested .. '/one.txt')
|
||||
|
||||
local summary = worktree.switch(other)
|
||||
|
||||
assert.is_not_nil(summary)
|
||||
assert.same({ 'one.txt' }, summary.moved)
|
||||
assert.same({}, summary.missing)
|
||||
assert.equals(realpath(other) .. '/one.txt', vim.api.nvim_buf_get_name(vim.fn.bufnr(realpath(other) .. '/one.txt')))
|
||||
end)
|
||||
|
||||
it('lands on a valid line when the destination file is empty', function()
|
||||
vim.fn.writefile({}, other .. '/one.txt')
|
||||
open(main .. '/one.txt')
|
||||
|
||||
Reference in New Issue
Block a user