vim-patch:8.2.3468: problem with :cd when editing file in non-existent directory

Problem:    Problem with :cd when editing file in non-existent directory. (Yee
            Cheng Chin)
Solution:   Prepend the current directory to get the full path. (closes vim/vim#8903)
c6376c7984
This commit is contained in:
zeertzjq
2021-11-19 20:07:04 +08:00
parent f71be1f87b
commit 0f58ba10e2
5 changed files with 44 additions and 13 deletions

View File

@@ -54,15 +54,21 @@ describe('path.c', function()
eq(lfs.currentdir(), (ffi.string(buffer)))
end)
itp('fails if the given directory does not exist', function()
eq(FAIL, path_full_dir_name('does_not_exist', buffer, length))
end)
itp('works with a normal relative dir', function()
local result = path_full_dir_name('unit-test-directory', buffer, length)
eq(lfs.currentdir() .. '/unit-test-directory', (ffi.string(buffer)))
eq(OK, result)
end)
itp('works with a non-existing relative dir', function()
local result = path_full_dir_name('does-not-exist', buffer, length)
eq(lfs.currentdir() .. '/does-not-exist', (ffi.string(buffer)))
eq(OK, result)
end)
itp('fails with a non-existing absolute dir', function()
eq(FAIL, path_full_dir_name('/does_not_exist', buffer, length))
end)
end)
describe('path_full_compare', function()