aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-09-06 18:19:57 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-09-06 09:19:57 -0700
commitfd8b00bacd2cde1e7aa0543acf58b1a7344f8daf (patch)
tree90a67cbaaa789e1f3e9a0abc23282f6c49b2bf73 /test/functional/helpers.lua
parent1dab52f87897d73c6a922be9b253de22b361cfb3 (diff)
downloadrneovim-fd8b00bacd2cde1e7aa0543acf58b1a7344f8daf.tar.gz
rneovim-fd8b00bacd2cde1e7aa0543acf58b1a7344f8daf.tar.bz2
rneovim-fd8b00bacd2cde1e7aa0543acf58b1a7344f8daf.zip
tests: do_rmdir(): improve error handling #10955
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index cf9f5f9858..5ec28dd0c7 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -577,8 +577,16 @@ function module.assert_alive()
end
local function do_rmdir(path)
- if lfs.attributes(path, 'mode') ~= 'directory' then
- return -- Don't complain.
+ local mode, errmsg, errcode = lfs.attributes(path, 'mode')
+ if mode == nil then
+ if errcode == 2 then
+ -- "No such file or directory", don't complain.
+ return
+ end
+ error(string.format('rmdir: %s (%d)', errmsg, errcode))
+ end
+ if mode ~= 'directory' then
+ error(string.format('rmdir: not a directory: %s', path))
end
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then