mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 00:18:33 +00:00
refactor/rename: path_try_shorten_fname()
This commit is contained in:
@@ -261,7 +261,7 @@ describe('path.c', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('path_shorten_fname_if_possible', function()
|
||||
describe('path_try_shorten_fname', function()
|
||||
local cwd = lfs.currentdir()
|
||||
|
||||
before_each(function()
|
||||
@@ -273,22 +273,22 @@ describe('path_shorten_fname_if_possible', function()
|
||||
lfs.rmdir('ut_directory')
|
||||
end)
|
||||
|
||||
describe('path_shorten_fname_if_possible', function()
|
||||
describe('path_try_shorten_fname', function()
|
||||
itp('returns shortened path if possible', function()
|
||||
lfs.chdir('ut_directory')
|
||||
local full = to_cstr(lfs.currentdir() .. '/subdir/file.txt')
|
||||
eq('subdir/file.txt', (ffi.string(cimp.path_shorten_fname_if_possible(full))))
|
||||
eq('subdir/file.txt', (ffi.string(cimp.path_try_shorten_fname(full))))
|
||||
end)
|
||||
|
||||
itp('returns `full_path` if a shorter version is not possible', function()
|
||||
local old = lfs.currentdir()
|
||||
lfs.chdir('ut_directory')
|
||||
local full = old .. '/subdir/file.txt'
|
||||
eq(full, (ffi.string(cimp.path_shorten_fname_if_possible(to_cstr(full)))))
|
||||
eq(full, (ffi.string(cimp.path_try_shorten_fname(to_cstr(full)))))
|
||||
end)
|
||||
|
||||
itp('returns NULL if `full_path` is NULL', function()
|
||||
eq(NULL, (cimp.path_shorten_fname_if_possible(NULL)))
|
||||
eq(NULL, (cimp.path_try_shorten_fname(NULL)))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user