diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-12-07 23:55:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-07 23:55:18 +0100 |
commit | ff99cbfc0273bb9f714c32a62ec02b888c196a2e (patch) | |
tree | bbfb82885565dc382721716f3d550a259852ad28 /test/functional/helpers.lua | |
parent | 8da23cb919e55825bc89f0ebfcebcc07374d9d18 (diff) | |
parent | 933c873cae64d3840bb0539b51a983a240eeff28 (diff) | |
download | rneovim-ff99cbfc0273bb9f714c32a62ec02b888c196a2e.tar.gz rneovim-ff99cbfc0273bb9f714c32a62ec02b888c196a2e.tar.bz2 rneovim-ff99cbfc0273bb9f714c32a62ec02b888c196a2e.zip |
Merge #5488 from justinmk/test-fix-mouse-drag
test: Disable unreliable test on travis+ASAN_UBSAN
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index ff62b4de86..d1ab02f361 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -243,6 +243,19 @@ local function connect(file_or_address) return Session.new(stream) end +-- Calls fn() until it returns without error, up to `max` times. +local function retry(fn, max) + local retries = max and (max - 1) or 2 + for _ = 1, retries do + local success = pcall(fn) + if success then + return + end + end + -- pcall() is not used for the final attempt so failure can bubble up. + fn() +end + local function clear(...) local args = {unpack(nvim_argv)} local new_args @@ -530,6 +543,7 @@ return function(after_each) prepend_argv = prepend_argv, clear = clear, connect = connect, + retry = retry, spawn = spawn, dedent = dedent, source = source, |