Skip to content

Commit

Permalink
test(lua/fs_spec): fix vim.fs.dir() test
Browse files Browse the repository at this point in the history
  • Loading branch information
zeertzjq committed Dec 22, 2022
1 parent 843ad83 commit 6a220d6
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions test/functional/lua/fs_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ describe('vim.fs', function()
end)

describe('dir()', function()
before_each(function()
mkdir_p('testd/a/b/c')
end)

after_each(function()
rmdir('testd')
end)

it('works', function()
eq(true, exec_lua([[
local dir, nvim = ...
Expand All @@ -143,21 +151,18 @@ describe('vim.fs', function()
end)

it('works with opts.depth and opts.skip', function()
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([[
Expand Down

0 comments on commit 6a220d6

Please sign in to comment.