feat(fs): add vim.fs.dir()

This function is modeled after the path.dir() function from Penlight and
the luafilesystem module.
This commit is contained in:
Gregory Anders
2022-05-15 20:10:12 -06:00
parent b740709431
commit 2a62bec37c
3 changed files with 41 additions and 0 deletions

View File

@@ -52,4 +52,18 @@ describe('vim.fs', function()
]], nvim_prog))
end)
end)
describe('dir()', function()
it('works', function()
eq(true, exec_lua([[
local dir, nvim = ...
for name, type in vim.fs.dir(dir) do
if name == nvim and type == 'file' then
return true
end
end
return false
]], nvim_dir, nvim_prog_basename))
end)
end)
end)