aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/fs_spec.lua
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2022-05-15 20:10:12 -0600
committerGregory Anders <greg@gpanders.com>2022-05-31 13:04:41 -0600
commit2a62bec37ced51678ff914700d7165605d5a0d53 (patch)
treea28b0a4318142aee3acceccd3a56cacf94b8b79b /test/functional/lua/fs_spec.lua
parentb740709431f5e68dac5238d455f9f86d5a564f36 (diff)
downloadrneovim-2a62bec37ced51678ff914700d7165605d5a0d53.tar.gz
rneovim-2a62bec37ced51678ff914700d7165605d5a0d53.tar.bz2
rneovim-2a62bec37ced51678ff914700d7165605d5a0d53.zip
feat(fs): add vim.fs.dir()
This function is modeled after the path.dir() function from Penlight and the luafilesystem module.
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 674a7f6957..6f1f1df012 100644
--- a/test/functional/lua/fs_spec.lua
+++ b/test/functional/lua/fs_spec.lua
@@ -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)