diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-22 22:46:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-22 22:46:07 +0800 |
commit | 98daaa798e018071876d026a60840991be8d8069 (patch) | |
tree | f64fa36534947dc9259357c993a0f20f52d457a6 /test/functional/lua/fs_spec.lua | |
parent | 6e0082b356821825faef643b96f4d21684ce2f6c (diff) | |
download | rneovim-98daaa798e018071876d026a60840991be8d8069.tar.gz rneovim-98daaa798e018071876d026a60840991be8d8069.tar.bz2 rneovim-98daaa798e018071876d026a60840991be8d8069.zip |
test(lua/fs_spec): fix vim.fs.dir() test (#21503)
Diffstat (limited to 'test/functional/lua/fs_spec.lua')
-rw-r--r-- | test/functional/lua/fs_spec.lua | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua index 02b1b6f027..20a1660b0e 100644 --- a/test/functional/lua/fs_spec.lua +++ b/test/functional/lua/fs_spec.lua @@ -1,4 +1,5 @@ local helpers = require('test.functional.helpers')(after_each) +local lfs = require('lfs') local clear = helpers.clear local exec_lua = helpers.exec_lua @@ -130,6 +131,17 @@ describe('vim.fs', function() end) describe('dir()', function() + before_each(function() + lfs.mkdir('testd') + lfs.mkdir('testd/a') + lfs.mkdir('testd/a/b') + lfs.mkdir('testd/a/b/c') + end) + + after_each(function() + rmdir('testd') + end) + it('works', function() eq(true, exec_lua([[ local dir, nvim = ... @@ -143,24 +155,18 @@ describe('vim.fs', function() end) it('works with opts.depth and opts.skip', function() - if is_os('win') then - pending() - end - helpers.funcs.system 'mkdir -p testd/a/b/c' - helpers.funcs.system('touch '..table.concat({ - 'testd/a1', - 'testd/b1', - 'testd/c1', - 'testd/a/a2', - 'testd/a/b2', - 'testd/a/c2', - 'testd/a/b/a3', - 'testd/a/b/b3', - 'testd/a/b/c3', - 'testd/a/b/c/a4', - 'testd/a/b/c/b4', - 'testd/a/b/c/c4', - }, ' ')) + io.open('testd/a1', 'w'):close() + io.open('testd/b1', 'w'):close() + io.open('testd/c1', 'w'):close() + io.open('testd/a/a2', 'w'):close() + io.open('testd/a/b2', 'w'):close() + io.open('testd/a/c2', 'w'):close() + io.open('testd/a/b/a3', 'w'):close() + io.open('testd/a/b/b3', 'w'):close() + io.open('testd/a/b/c3', 'w'):close() + io.open('testd/a/b/c/a4', 'w'):close() + io.open('testd/a/b/c/b4', 'w'):close() + io.open('testd/a/b/c/c4', 'w'):close() local function run(dir, depth, skip) local r = exec_lua([[ |