mirror of
https://github.com/neovim/neovim.git
synced 2026-04-26 17:24:18 +00:00
fix(vim.fs): joinpath() does not normalize slashes on Windows #31782
This commit is contained in:
@@ -323,6 +323,20 @@ describe('vim.fs', function()
|
||||
eq('foo/bar/baz', vim.fs.joinpath('foo', 'bar', 'baz'))
|
||||
eq('foo/bar/baz', vim.fs.joinpath('foo', '/bar/', '/baz'))
|
||||
end)
|
||||
it('rewrites backslashes on Windows', function()
|
||||
if is_os('win') then
|
||||
eq('foo/bar/baz/zub/', vim.fs.joinpath([[foo]], [[\\bar\\\\baz]], [[zub\]]))
|
||||
else
|
||||
eq([[foo/\\bar\\\\baz/zub\]], vim.fs.joinpath([[foo]], [[\\bar\\\\baz]], [[zub\]]))
|
||||
end
|
||||
end)
|
||||
it('strips redundant slashes', function()
|
||||
if is_os('win') then
|
||||
eq('foo/bar/baz/zub/', vim.fs.joinpath([[foo//]], [[\\bar\\\\baz]], [[zub\]]))
|
||||
else
|
||||
eq('foo/bar/baz/zub/', vim.fs.joinpath([[foo]], [[//bar////baz]], [[zub/]]))
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('normalize()', function()
|
||||
|
||||
Reference in New Issue
Block a user