From dbd76c2c414e24ed3e961568567a3a60f97cf2fb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 13 Mar 2025 08:42:02 +0800 Subject: test: reduce flakiness in blocking wait tests (#32868) --- test/functional/core/job_spec.lua | 8 +++++++- test/functional/ui/cursor_spec.lua | 16 ++++++++++++++-- test/functional/ui/messages_spec.lua | 8 +++++++- 3 files changed, 28 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 7a50993171..5697dbc56f 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -944,7 +944,13 @@ describe('jobs', function() echon "\nccc" endfunc ]]) - feed_command('call PrintAndWait()') + feed(':call PrintAndWait()') + screen:expect([[ + | + {1:~ }|*4 + :call PrintAndWait()^ | + ]]) + feed('') screen:expect { grid = [[ | diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua index 7bef26f842..ff304db54c 100644 --- a/test/functional/ui/cursor_spec.lua +++ b/test/functional/ui/cursor_spec.lua @@ -379,7 +379,13 @@ describe('ui/cursor', function() end) it(':sleep does not hide cursor when sleeping', function() - n.feed(':sleep 300m | echo 42\n') + n.feed(':sleep 300m | echo 42') + screen:expect([[ + | + {1:~ }|*3 + :sleep 300m | echo 42^ | + ]]) + n.feed('\n') screen:expect({ grid = [[ ^ | @@ -396,7 +402,13 @@ describe('ui/cursor', function() end) it(':sleep! hides cursor when sleeping', function() - n.feed(':sleep! 300m | echo 42\n') + n.feed(':sleep! 300m | echo 42') + screen:expect([[ + | + {1:~ }|*3 + :sleep! 300m | echo 42^ | + ]]) + n.feed('\n') screen:expect({ grid = [[ | diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index a6577f3ca0..93ec608462 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -2028,7 +2028,13 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim echon "\nccc" endfunc ]]):format(to_block)) - feed(':call PrintAndWait()') + feed(':call PrintAndWait()') + screen:expect([[ + | + {1:~ }|*5 + :call PrintAndWait()^ | + ]]) + feed('') screen:expect { grid = [[ | -- cgit