diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2023-01-17 00:12:59 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2023-01-17 00:19:30 +0100 |
commit | 665a7dafaf892b31285f35a43a90fc6e968fd7da (patch) | |
tree | 7da94ed4e3e9eaa4018a84ba43234bb39c598c35 /test/functional/helpers.lua | |
parent | 6ec7bcb6184f562157eebc8d0f25f78ba333c6a5 (diff) | |
download | rneovim-665a7dafaf892b31285f35a43a90fc6e968fd7da.tar.gz rneovim-665a7dafaf892b31285f35a43a90fc6e968fd7da.tar.bz2 rneovim-665a7dafaf892b31285f35a43a90fc6e968fd7da.zip |
refactor(tests): lift retry() into assert_log()
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 4e8bf1a323..6400db9f87 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -1,5 +1,4 @@ require('coxpcall') -local busted = require('busted') local luv = require('luv') local lfs = require('lfs') local mpack = require('mpack') @@ -434,28 +433,6 @@ function module.connect(file_or_address) return Session.new(stream) end --- Calls fn() until it succeeds, up to `max` times or until `max_ms` --- milliseconds have passed. -function module.retry(max, max_ms, fn) - assert(max == nil or max > 0) - assert(max_ms == nil or max_ms > 0) - local tries = 1 - local timeout = (max_ms and max_ms or 10000) - local start_time = luv.now() - while true do - local status, result = pcall(fn) - if status then - return result - end - luv.update_time() -- Update cached value of luv.now() (libuv: uv_now()). - if (max and tries >= max) or (luv.now() - start_time > timeout) then - busted.fail(string.format("retry() attempts: %d\n%s", tries, tostring(result)), 2) - end - tries = tries + 1 - luv.sleep(20) -- Avoid hot loop... - end -end - -- Starts a new global Nvim session. -- -- Parameters are interpreted as startup args, OR a map with these keys: |