tests: improve robustness of immediate successes in screen tests

This commit is contained in:
Björn Linse
2017-06-26 14:49:15 +02:00
parent 8fd092f3ff
commit c8810a51a3
20 changed files with 314 additions and 147 deletions

View File

@@ -874,20 +874,23 @@ describe('put command', function()
local function bell_test(actions, should_ring)
local screen = Screen.new()
screen:attach()
if should_ring then
-- check bell is not set by nvim before the action
screen:sleep(50)
end
helpers.ok(not screen.bell and not screen.visualbell)
actions()
helpers.wait()
screen:wait(function()
screen:expect{condition=function()
if should_ring then
if not screen.bell and not screen.visualbell then
return 'Bell was not rung after action'
error('Bell was not rung after action')
end
else
if screen.bell or screen.visualbell then
return 'Bell was rung after action'
error('Bell was rung after action')
end
end
end)
end, unchanged=(not should_ring)}
screen:detach()
end