aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-01-04 13:32:39 +0100
committerGitHub <noreply@github.com>2017-01-04 13:32:39 +0100
commit0ce77a744a381689614f578a6eef0853b4cada9a (patch)
treef72a08e0f63dde3831ed69cc14bf141e8e55bc20 /test/functional/helpers.lua
parentd8a97d7b7912ae981c3b904ccbd014b2f2da1832 (diff)
parente03b43bd07bd359076c7332f1cb874ebc5308951 (diff)
downloadrneovim-0ce77a744a381689614f578a6eef0853b4cada9a.tar.gz
rneovim-0ce77a744a381689614f578a6eef0853b4cada9a.tar.bz2
rneovim-0ce77a744a381689614f578a6eef0853b4cada9a.zip
Merge #5749 from justinmk/test-ctrl-c
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua25
1 files changed, 21 insertions, 4 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index ed153182ca..5eec3afe65 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -492,12 +492,12 @@ local function create_callindex(func)
end
-- Helper to skip tests. Returns true in Windows systems.
--- pending_func is pending() from busted
-local function pending_win32(pending_func)
+-- pending_fn is pending() from busted
+local function pending_win32(pending_fn)
clear()
if uname() == 'Windows' then
- if pending_func ~= nil then
- pending_func('FIXME: Windows', function() end)
+ if pending_fn ~= nil then
+ pending_fn('FIXME: Windows', function() end)
end
return true
else
@@ -505,6 +505,22 @@ local function pending_win32(pending_func)
end
end
+-- Calls pending() and returns `true` if the system is too slow to
+-- run fragile or expensive tests. Else returns `false`.
+local function skip_fragile(pending_fn, cond)
+ if pending_fn == nil or type(pending_fn) ~= type(function()end) then
+ error("invalid pending_fn")
+ end
+ if cond then
+ pending_fn("skipped (test is fragile on this system)", function() end)
+ return true
+ elseif os.getenv("TEST_SKIP_FRAGILE") then
+ pending_fn("skipped (TEST_SKIP_FRAGILE)", function() end)
+ return true
+ end
+ return false
+end
+
local funcs = create_callindex(nvim_call)
local meths = create_callindex(nvim)
local uimeths = create_callindex(ui)
@@ -573,6 +589,7 @@ return function(after_each)
curwinmeths = curwinmeths,
curtabmeths = curtabmeths,
pending_win32 = pending_win32,
+ skip_fragile = skip_fragile,
tmpname = tmpname,
NIL = mpack.NIL,
}