aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/fs_spec.lua
diff options
context:
space:
mode:
authorEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2023-06-18 14:49:33 +0300
committerGitHub <noreply@github.com>2023-06-18 06:49:33 -0500
commit8a7e3353eb5bffb10015254917361266b4b20511 (patch)
tree35055b4a66d92c9099eeb92bf7f84ff38774d2fe /test/functional/lua/fs_spec.lua
parent7e301ed5b9f72a98086c7004d090ad9aef137485 (diff)
downloadrneovim-8a7e3353eb5bffb10015254917361266b4b20511.tar.gz
rneovim-8a7e3353eb5bffb10015254917361266b4b20511.tar.bz2
rneovim-8a7e3353eb5bffb10015254917361266b4b20511.zip
fix(fs): make `normalize()` work with '/' path (#24047)
Problem: Current implementation of "remove trailing /" doesn't account for the case of literal '/' as path. Solution: Remove trailing / only if it preceded by something else. Co-authored by: notomo <notomo.motono@gmail.com>
Diffstat (limited to 'test/functional/lua/fs_spec.lua')
-rw-r--r--test/functional/lua/fs_spec.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua
index aae0ed91a7..c1091cff60 100644
--- a/test/functional/lua/fs_spec.lua
+++ b/test/functional/lua/fs_spec.lua
@@ -281,6 +281,12 @@ describe('vim.fs', function()
it('works with backward slashes', function()
eq('C:/Users/jdoe', exec_lua [[ return vim.fs.normalize('C:\\Users\\jdoe') ]])
end)
+ it('removes trailing /', function()
+ eq('/home/user', exec_lua [[ return vim.fs.normalize('/home/user/') ]])
+ end)
+ it('works with /', function()
+ eq('/', exec_lua [[ return vim.fs.normalize('/') ]])
+ end)
it('works with ~', function()
eq( exec_lua([[
local home = ...