mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #3056 'Test: fix functional/ex_cmds/recover_spec.lua'.
This commit is contained in:
commit
0e39b2c936
@ -20,11 +20,11 @@ describe(':preserve', function()
|
|||||||
local swapdir = lfs.currentdir()..'/testdir_recover_spec'
|
local swapdir = lfs.currentdir()..'/testdir_recover_spec'
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
os.remove(swapdir)
|
helpers.rmdir(swapdir)
|
||||||
lfs.mkdir(swapdir)
|
lfs.mkdir(swapdir)
|
||||||
end)
|
end)
|
||||||
after_each(function()
|
after_each(function()
|
||||||
os.remove(swapdir)
|
helpers.rmdir(swapdir)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("saves to custom 'directory' and (R)ecovers (issue #1836)", function()
|
it("saves to custom 'directory' and (R)ecovers (issue #1836)", function()
|
||||||
|
@ -290,6 +290,28 @@ local function expect(contents)
|
|||||||
return eq(dedent(contents), curbuf_contents())
|
return eq(dedent(contents), curbuf_contents())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function rmdir(path)
|
||||||
|
if lfs.attributes(path, 'mode') ~= 'directory' then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
for file in lfs.dir(path) do
|
||||||
|
if file == '.' or file == '..' then
|
||||||
|
goto continue
|
||||||
|
end
|
||||||
|
ret, err = os.remove(path..'/'..file)
|
||||||
|
if not ret then
|
||||||
|
error('os.remove: '..err)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
::continue::
|
||||||
|
end
|
||||||
|
ret, err = os.remove(path)
|
||||||
|
if not ret then
|
||||||
|
error('os.remove: '..err)
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
clear = clear,
|
clear = clear,
|
||||||
spawn = spawn,
|
spawn = spawn,
|
||||||
@ -321,5 +343,6 @@ return {
|
|||||||
curbuf_contents = curbuf_contents,
|
curbuf_contents = curbuf_contents,
|
||||||
wait = wait,
|
wait = wait,
|
||||||
set_session = set_session,
|
set_session = set_session,
|
||||||
write_file = write_file
|
write_file = write_file,
|
||||||
|
rmdir = rmdir
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user