Merge pull request #17578 from zeertzjq/test-warning-poke

test: mention poke_eventloop() instead of wait()
This commit is contained in:
zeertzjq 2022-03-03 06:23:10 +08:00 committed by GitHub
commit 85de9b06ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -94,7 +94,7 @@ local function screen_setup(extra_rows, command, cols, opts)
table.insert(expected, '{3:-- TERMINAL --}' .. ((' '):rep(cols - 14)))
screen:expect(table.concat(expected, '|\n')..'|')
else
-- This eval also acts as a wait().
-- This eval also acts as a poke_eventloop().
if 0 == nvim('eval', "exists('b:terminal_job_id')") then
error("terminal job failed to start")
end

View File

@ -576,16 +576,16 @@ to the test if they make sense.
print([[
warning: Screen changes were received after the expected state. This indicates
indeterminism in the test. Try adding screen:expect(...) (or wait()) between
asynchronous (feed(), nvim_input()) and synchronous API calls.
indeterminism in the test. Try adding screen:expect(...) (or poke_eventloop())
between asynchronous (feed(), nvim_input()) and synchronous API calls.
- Use screen:redraw_debug() to investigate; it may find relevant intermediate
states that should be added to the test to make it more robust.
- If the purpose of the test is to assert state after some user input sent
with feed(), adding screen:expect() before the feed() will help to ensure
the input is sent when Nvim is in a predictable state. This is preferable
to wait(), for being closer to real user interaction.
- wait() can trigger redraws and consequently generate more indeterminism.
Try removing wait().
to poke_eventloop(), for being closer to real user interaction.
- poke_eventloop() can trigger redraws and thus generate more indeterminism.
Try removing poke_eventloop().
]])
did_warn = true
end