tests: fix/improve Screen:expect_unchanged (#10577)

Do not sleep before collecting initial state.

Ref: https://github.com/neovim/neovim/pull/10550#issuecomment-513670205
This commit is contained in:
Daniel Hahler 2019-07-24 02:50:24 +02:00 committed by GitHub
parent b59a1f7b52
commit 8fc93241d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -450,12 +450,12 @@ end
function Screen:expect_unchanged(waittime_ms, ignore_attrs, request_cb)
waittime_ms = waittime_ms and waittime_ms or 100
-- Collect the current screen state.
self:sleep(waittime_ms, request_cb)
self:sleep(0, request_cb)
local kwargs = self:get_snapshot(nil, ignore_attrs)
-- Wait for potential changes.
self:sleep(waittime_ms, request_cb)
-- Check that screen state does not change.
kwargs.unchanged = true
-- Check that screen state did not change.
kwargs.timeout = waittime_ms
self:expect(kwargs)
end

View File

@ -158,6 +158,7 @@ describe('search highlighting', function()
bar foo baz
]])
feed('/foo')
helpers.wait()
screen:expect_unchanged()
end)