aboutsummaryrefslogtreecommitdiff
path: root/test/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-12 10:52:13 +0100
committerGitHub <noreply@github.com>2017-03-12 10:52:13 +0100
commitc8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c (patch)
treed993945c472a610a265baa79d714c6d32f149f14 /test/helpers.lua
parentb2b15e6e137d7be2b01bf2174791f36bd12981bd (diff)
parent48e7a83447c0a1a59a110b5ca9e712f560fd9e03 (diff)
downloadrneovim-c8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c.tar.gz
rneovim-c8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c.tar.bz2
rneovim-c8f0f8fea6e3170db0d68d61dd84f3c3ef9ee77c.zip
Merge #6214 from ZyX-I/split-eval'/isolated-unittests
Run all unit tests in separate processes
Diffstat (limited to 'test/helpers.lua')
-rw-r--r--test/helpers.lua28
1 files changed, 21 insertions, 7 deletions
diff --git a/test/helpers.lua b/test/helpers.lua
index 25ab80bb50..e5224349c2 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -30,13 +30,15 @@ local function glob(initial_path, re, exc_re)
if ((not exc_re or not checked_path:match(exc_re))
and e:sub(1, 1) ~= '.') then
local attrs = lfs.attributes(full_path)
- local check_key = attrs.dev .. ':' .. tostring(attrs.ino)
- if not checked_files[check_key] then
- checked_files[check_key] = true
- if attrs.mode == 'directory' then
- paths_to_check[#paths_to_check + 1] = full_path
- elseif not re or checked_path:match(re) then
- ret[#ret + 1] = full_path
+ if attrs then
+ local check_key = attrs.dev .. ':' .. tostring(attrs.ino)
+ if not checked_files[check_key] then
+ checked_files[check_key] = true
+ if attrs.mode == 'directory' then
+ paths_to_check[#paths_to_check + 1] = full_path
+ elseif not re or checked_path:match(re) then
+ ret[#ret + 1] = full_path
+ end
end
end
end
@@ -212,6 +214,17 @@ local function check_cores(app)
end
end
+local function which(exe)
+ local pipe = io.popen('which ' .. exe, 'r')
+ local ret = pipe:read('*a')
+ pipe:close()
+ if ret == '' then
+ return nil
+ else
+ return ret:sub(1, -2)
+ end
+end
+
return {
eq = eq,
neq = neq,
@@ -224,4 +237,5 @@ return {
glob = glob,
check_cores = check_cores,
hasenv = hasenv,
+ which = which,
}