mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
test: make expect_unchanged() less confusing (#22255)
Problem: The sleep before collecting the initial screen state is confusing and may lead to unexpected success if it comes after a blocking RPC call. Solution: Remove that sleep and add an "intermediate" argument.
This commit is contained in:
@@ -470,15 +470,19 @@ screen:redraw_debug() to show all intermediate screen states. ]])
|
||||
end, expected)
|
||||
end
|
||||
|
||||
function Screen:expect_unchanged(waittime_ms, ignore_attrs, request_cb)
|
||||
function Screen:expect_unchanged(intermediate, waittime_ms, ignore_attrs)
|
||||
waittime_ms = waittime_ms and waittime_ms or 100
|
||||
-- Collect the current screen state.
|
||||
self:sleep(0, request_cb)
|
||||
local kwargs = self:get_snapshot(nil, ignore_attrs)
|
||||
|
||||
-- Check that screen state does not change.
|
||||
kwargs.unchanged = true
|
||||
if intermediate then
|
||||
kwargs.intermediate = true
|
||||
else
|
||||
kwargs.unchanged = true
|
||||
end
|
||||
|
||||
kwargs.timeout = waittime_ms
|
||||
-- Check that screen state does not change.
|
||||
self:expect(kwargs)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user