diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua index de6e9f1350..8ab73650a6 100644 --- a/test/functional/lua/fs_spec.lua +++ b/test/functional/lua/fs_spec.lua @@ -100,6 +100,10 @@ describe('vim.fs', function() test_paths(tests_windows_paths, true) end end) + + it('trims redundant slashes #37698', function() + eq('/name', vim.fs.dirname('/name//////////')) + end) end) describe('basename()', function() @@ -128,6 +132,12 @@ describe('vim.fs', function() test_paths(tests_windows_paths, true) end end) + + it('trims redundant slashes #37698', function() + -- XXX: for better or worse, this matches python's `os.path.basename`. + -- https://github.com/neovim/neovim/issues/37698#issuecomment-3847866806 + eq('', vim.fs.basename('/name//////////')) + end) end) describe('dir()', function()