feat(fs): expose join_paths as vim.fs.joinpath (#23685)

This is a small function but used a lot in some plugins.
This commit is contained in:
Christian Clason
2023-05-20 17:30:48 +02:00
committed by GitHub
parent 073035a030
commit e3e6fadfd8
3 changed files with 30 additions and 9 deletions

View File

@@ -266,6 +266,17 @@ describe('vim.fs', function()
end)
end)
describe('joinpath()', function()
it('works', function()
eq('foo/bar/baz', exec_lua([[
return vim.fs.joinpath('foo', 'bar', 'baz')
]], nvim_dir))
eq('foo/bar/baz', exec_lua([[
return vim.fs.joinpath('foo', '/bar/', '/baz')
]], nvim_dir))
end)
end)
describe('normalize()', function()
it('works with backward slashes', function()
eq('C:/Users/jdoe', exec_lua [[ return vim.fs.normalize('C:\\Users\\jdoe') ]])