test(vim.fs): basename(), dirname() trim trailing slashes #39790

close #37698
This commit is contained in:
Justin M. Keyes
2026-05-14 16:02:31 -04:00
committed by GitHub
parent adb5d8a646
commit 6bb3e1b239

View File

@@ -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()