aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-04-11 03:14:10 +0200
committerGitHub <noreply@github.com>2017-04-11 03:14:10 +0200
commit337299c8082347feecb5e733bed993c6a5933456 (patch)
treeb2f491c54f8ed3a4ed57e1b78bf907b918b8b34c /test/functional/helpers.lua
parent9aface8c4d1edd25d4fed3e099e3c2c02b0a282a (diff)
parentde378477cc3ebface5da5dbd24015959755f137e (diff)
downloadrneovim-337299c8082347feecb5e733bed993c6a5933456.tar.gz
rneovim-337299c8082347feecb5e733bed993c6a5933456.tar.bz2
rneovim-337299c8082347feecb5e733bed993c6a5933456.zip
Merge #6490 from justinmk/test
Closes #6487
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 13b06e7f1b..7edb2381e8 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -32,20 +32,15 @@ local nvim_set = 'set shortmess+=I background=light noswapfile noautoindent'
..' belloff= noshowcmd noruler nomore'
local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
'--cmd', nvim_set, '--embed'}
-
-local mpack = require('mpack')
-
-local tmpname = global_helpers.tmpname
-local uname = global_helpers.uname
-
--- Formulate a path to the directory containing nvim. We use this to
--- help run test executables. It helps to keep the tests working, even
--- when the build is not in the default location.
+-- Directory containing nvim.
local nvim_dir = nvim_prog:gsub("[/\\][^/\\]+$", "")
if nvim_dir == nvim_prog then
nvim_dir = "."
end
+local mpack = require('mpack')
+local tmpname = global_helpers.tmpname
+local uname = global_helpers.uname
local prepend_argv
if os.getenv('VALGRIND') then
@@ -430,21 +425,27 @@ end
local function do_rmdir(path)
if lfs.attributes(path, 'mode') ~= 'directory' then
- return nil
+ return -- Don't complain.
end
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then
local abspath = path..'/'..file
if lfs.attributes(abspath, 'mode') == 'directory' then
- local ret = do_rmdir(abspath) -- recurse
- if not ret then
- return nil
- end
+ do_rmdir(abspath) -- recurse
else
local ret, err = os.remove(abspath)
if not ret then
- error('os.remove: '..err)
- return nil
+ if not session then
+ error('os.remove: '..err)
+ else
+ -- Try Nvim delete(): it handles `readonly` attribute on Windows,
+ -- and avoids Lua cross-version/platform incompatibilities.
+ if -1 == nvim_call('delete', abspath) then
+ local hint = (os_name() == 'windows'
+ and ' (hint: try :%bwipeout! before rmdir())' or '')
+ error('delete() failed'..hint..': '..abspath)
+ end
+ end
end
end
end
@@ -453,7 +454,6 @@ local function do_rmdir(path)
if not ret then
error('lfs.rmdir('..path..'): '..err)
end
- return ret
end
local function rmdir(path)