aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/fs_spec.lua
diff options
context:
space:
mode:
authorGustav Eikaas <46537983+GustavEikaas@users.noreply.github.com>2024-12-31 16:40:05 +0100
committerGitHub <noreply@github.com>2024-12-31 07:40:05 -0800
commit0bef3b911cc262a007fb4412d864c1832d1268ad (patch)
tree0f9e53d86a429388021931b7541250aa03f86986 /test/functional/lua/fs_spec.lua
parentb3bdba5cb10f9f0f1f2b40ff40e807f8a22f65c1 (diff)
downloadrneovim-0bef3b911cc262a007fb4412d864c1832d1268ad.tar.gz
rneovim-0bef3b911cc262a007fb4412d864c1832d1268ad.tar.bz2
rneovim-0bef3b911cc262a007fb4412d864c1832d1268ad.zip
fix(vim.fs): joinpath() does not normalize slashes on Windows #31782
Diffstat (limited to 'test/functional/lua/fs_spec.lua')
-rw-r--r--test/functional/lua/fs_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua
index 63444f5ba1..3c306e6824 100644
--- a/test/functional/lua/fs_spec.lua
+++ b/test/functional/lua/fs_spec.lua
@@ -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()