From 3210315559b0a4a3e225ca3cf533b2184721b7f4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 2 Jul 2026 21:07:07 +0800 Subject: [PATCH] vim-patch:9.2.0426: tests: still some flaky screendump tests Problem: tests: still some flaky screendump tests (James McCoy) Solution: Replace flaky VerifyScreenDump checks with assert_* assertions for Test_visual_block_scroll and Test_scrolloffpad_with_folds, and remove the now-unused dump files, mark those tests as flaky (which happened previously for screendump tests automatically) (Yasuhiro Matsumoto). fixes: vim/vim#20096 related: vim/vim#20095 https://github.com/vim/vim/commit/cf5d7102b9624f1bf230b6efad22f9bd0b39bd53 Co-authored-by: Yasuhiro Matsumoto --- test/old/testdir/test_plugin_matchparen.vim | 13 ++++--- test/old/testdir/test_scroll_opt.vim | 39 ++++++++++++++------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/test/old/testdir/test_plugin_matchparen.vim b/test/old/testdir/test_plugin_matchparen.vim index 506cfc38cf..790f9e2a7e 100644 --- a/test/old/testdir/test_plugin_matchparen.vim +++ b/test/old/testdir/test_plugin_matchparen.vim @@ -10,8 +10,8 @@ source screendump.vim " Test for scrolling that modifies buffer during visual block func Test_visual_block_scroll() - CheckScreendump - + CheckRunVimInTerminal + let g:test_is_flaky = 1 let lines =<< trim END source $VIMRUNTIME/plugin/matchparen.vim set scrolloff=1 @@ -25,8 +25,13 @@ func Test_visual_block_scroll() let buf = RunVimInTerminal('-S '.filename, #{rows: 7}) call term_sendkeys(buf, "V\\") - call WaitForAssert({-> assert_match('VISUAL.*\d\+\s\+\d', term_getline(buf, 7))}, 1000) - call VerifyScreenDump(buf, 'Test_display_visual_block_scroll', {}) + call WaitForAssert({-> assert_equal('{', trim(term_getline(buf, 1)))}, 1000) + call assert_equal('}', trim(term_getline(buf, 2))) + call assert_equal('{', trim(term_getline(buf, 3))) + call assert_equal('f', trim(term_getline(buf, 4))) + call assert_equal('g', trim(term_getline(buf, 5))) + call assert_equal('}', trim(term_getline(buf, 6))) + call assert_match('VISUAL LINE .*1,1\s\+Bot', term_getline(buf, 7)) call StopVimInTerminal(buf) endfunc diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 909bd3833c..fbf8e51e7d 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -2051,9 +2051,9 @@ func Test_scrolloffpad_diff_eof_filler_behavior() endfunc func Test_scrolloffpad_with_folds() - CheckScreendump CheckRunVimInTerminal CheckFeature folding + let g:test_is_flaky = 1 let save_termwinsize = &termwinsize set termwinsize= @@ -2078,27 +2078,40 @@ func Test_scrolloffpad_with_folds() let buf = RunVimInTerminal('-S XScrolloffpadFolds', #{rows: 20, cols: 78}) - " Case 1: Jump to end-of-file - " With folds present, scrolloffpad should still - " keep the cursor positioned with padding below EOF + " Case 1: Jump to end-of-file. + " With folds present, scrolloffpad should still keep the cursor positioned + " with padding below EOF. call term_sendkeys(buf, "\:\normal! G\") call term_sendkeys(buf, "\") - call TermWait(buf) - call VerifyScreenDump(buf, 'Test_scrolloffpad_folds_1', {}) + call WaitForAssert({-> assert_equal('line 120', trim(term_getline(buf, 10)))}, + \ 1000) + call assert_equal('line 111', trim(term_getline(buf, 1))) + call assert_equal('line 119', trim(term_getline(buf, 9))) + call assert_equal('~', trim(term_getline(buf, 11))) + call assert_match('120,1\s\+Bot', term_getline(buf, 20)) - " Case 2: Move to the folded line to ensure the fold is actually in view + " Case 2: Move to the folded line to ensure the fold is actually in view. call term_sendkeys(buf, "\:\normal! 60G\") call term_sendkeys(buf, "\") - call TermWait(buf) - call VerifyScreenDump(buf, 'Test_scrolloffpad_folds_2', {}) + call WaitForAssert({-> assert_match('^\s*+-- 51 lines: line 60--', + \ term_getline(buf, 10))}, 1000) + call assert_equal('line 51', trim(term_getline(buf, 1))) + call assert_equal('line 59', trim(term_getline(buf, 9))) + call assert_equal('line 111', trim(term_getline(buf, 11))) + call assert_equal('line 119', trim(term_getline(buf, 19))) + call assert_match('60,1\s\+98%', term_getline(buf, 20)) - " Case 3: Close the fold explicitly and go to EOF again - " Behavior should remain stable with closed folds + " Case 3: Close the fold explicitly and go to EOF again. + " Behavior should remain stable with closed folds. call term_sendkeys(buf, "\:\normal! zc\") call term_sendkeys(buf, "\:\normal! G\") call term_sendkeys(buf, "\") - call TermWait(buf) - call VerifyScreenDump(buf, 'Test_scrolloffpad_folds_3', {}) + call WaitForAssert({-> assert_equal('line 120', trim(term_getline(buf, 10)))}, + \ 1000) + call assert_equal('line 111', trim(term_getline(buf, 1))) + call assert_equal('line 119', trim(term_getline(buf, 9))) + call assert_equal('~', trim(term_getline(buf, 11))) + call assert_match('120,1\s\+Bot', term_getline(buf, 20)) call StopVimInTerminal(buf) let &termwinsize = save_termwinsize