diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-15 07:26:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 07:26:55 +0800 |
commit | 05faa8f30ad770d4e4ead41cec601ccced8fb97f (patch) | |
tree | 23680deec8f90b7159c23f19f0a7a042ac1941f7 /test/functional/ui/screen.lua | |
parent | 556f8646c01d1751cf39fe4df9c622899dceab9d (diff) | |
download | rneovim-05faa8f30ad770d4e4ead41cec601ccced8fb97f.tar.gz rneovim-05faa8f30ad770d4e4ead41cec601ccced8fb97f.tar.bz2 rneovim-05faa8f30ad770d4e4ead41cec601ccced8fb97f.zip |
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.
Diffstat (limited to 'test/functional/ui/screen.lua')
-rw-r--r-- | test/functional/ui/screen.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index a059fb5b89..7760f26fca 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -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 |