test: retry(): Report number of retries. (#6475)

tui_spec.lua: Retry the terminal-mode test.
This commit is contained in:
Justin M. Keyes
2017-04-09 02:11:08 +02:00
committed by GitHub
parent cd0a436622
commit a34408ef7f
2 changed files with 61 additions and 52 deletions

View File

@@ -246,12 +246,13 @@ local function retry(max, max_ms, fn)
return result
end
if (max and tries >= max) or (luv.now() - start_time > timeout) then
break
if type(result) == "string" then
result = "\nretry() attempts: "..tostring(tries).."\n"..result
end
error(result)
end
tries = tries + 1
end
-- Do not use pcall() for the final attempt, let the failure bubble up.
return fn()
end
local function clear(...)