mirror of
https://github.com/neovim/neovim.git
synced 2025-11-03 09:14:24 +00:00
tests: Repeat a flaky part of the migrated test 61.
This is the part of the test that relies on wall clock time and sometimes fails if the system is under load. The test is repeated up to three times before a failure is reported to the user.
This commit is contained in:
@@ -38,6 +38,13 @@ describe('undo:', function()
|
||||
-- We write the test text to a file in order to prevent nvim to record
|
||||
-- the inserting of the text into the undo history.
|
||||
write_file('Xtest', '\n123456789\n')
|
||||
|
||||
|
||||
-- `:earlier` and `:later` are (obviously) time-sensitive, so this test
|
||||
-- sometimes fails if the system is under load. It is wrapped in a local
|
||||
-- function to allow multiple attempts.
|
||||
local function test_earlier_later()
|
||||
clear()
|
||||
execute('e Xtest')
|
||||
-- Assert that no undo history is present.
|
||||
eq({}, eval('undotree().entries'))
|
||||
@@ -92,6 +99,18 @@ describe('undo:', function()
|
||||
expect_line('123456')
|
||||
execute('later 1h')
|
||||
expect_line('123456abc')
|
||||
end
|
||||
local success, result = false, ''
|
||||
for i = 1, 2 do
|
||||
success, result = pcall(test_earlier_later)
|
||||
if success then
|
||||
return
|
||||
end
|
||||
end
|
||||
-- We did not return in the loop so there was an error or failure.
|
||||
-- We now try to run the test again but will not catch further errors,
|
||||
-- so the user will see them.
|
||||
test_earlier_later()
|
||||
end)
|
||||
|
||||
it('work with file write specifications', function()
|
||||
|
||||
Reference in New Issue
Block a user