diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-06-05 02:51:50 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-06-06 11:04:09 -0400 |
commit | 5f5f2d89456585c4dba337c879a34f322dcae32d (patch) | |
tree | fe792e520e00aed56fcef416078088e2d55be87a /test/functional/helpers.lua | |
parent | af161dcfb88f2a6886f9e0a7fbfe24cd58c3f658 (diff) | |
download | rneovim-5f5f2d89456585c4dba337c879a34f322dcae32d.tar.gz rneovim-5f5f2d89456585c4dba337c879a34f322dcae32d.tar.bz2 rneovim-5f5f2d89456585c4dba337c879a34f322dcae32d.zip |
test: rmdir(): recursively delete
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 37b7bf664c..846ce72e14 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -345,10 +345,18 @@ local function rmdir(path) end for file in lfs.dir(path) do if file ~= '.' and file ~= '..' then - local ret, err = os.remove(path..'/'..file) - if not ret then - error('os.remove: '..err) - return nil + local abspath = path..'/'..file + if lfs.attributes(abspath, 'mode') == 'directory' then + local ret = rmdir(abspath) -- recurse + if not ret then + return nil + end + else + local ret, err = os.remove(abspath) + if not ret then + error('os.remove: '..err) + return nil + end end end end |