From ba89354a4543c89c38faa74becabb9be0255d137 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 29 Mar 2026 22:26:46 +0800 Subject: [PATCH] vim-patch:9.2.0270: test: trailing spaces used in tests Problem: test: trailing spaces used in tests Solution: Rewrite tests to avoid trailing spaces (Paul Ollis). Some tests currently rely on trailing whitespace at the end of lines, escaped with '\'. I have demonstrated in another PR, such spaces can be inadvertently removed and this is difficult to spot. Note: there are more trailing spaces in a few more test files, see testdir/test_codestyle.vim. Those are not yet removed. closes: vim/vim#19838 https://github.com/vim/vim/commit/211ceea602f30b2c075737a36cccc4eea5967349 Co-authored-by: Paul Ollis --- test/functional/legacy/conceal_spec.lua | 2 +- test/old/testdir/test_conceal.vim | 2 +- test/old/testdir/test_display.vim | 4 ++-- test/old/testdir/test_ins_complete.vim | 4 +++- test/old/testdir/test_listchars.vim | 4 ++-- test/old/testdir/test_normal.vim | 1 + test/old/testdir/test_scroll_opt.vim | 3 ++- test/old/testdir/test_signs.vim | 4 +++- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/test/functional/legacy/conceal_spec.lua b/test/functional/legacy/conceal_spec.lua index 66a99fe684..6c347eac85 100644 --- a/test/functional/legacy/conceal_spec.lua +++ b/test/functional/legacy/conceal_spec.lua @@ -393,7 +393,7 @@ describe('Conceal', function() \ "three |hidden| three three three three three three three three"] call setline(1, lines) set wrap linebreak - set showbreak=\ >>>\ + let &showbreak = ' >>> ' syntax match test /|hidden|/ conceal set conceallevel=2 set concealcursor= diff --git a/test/old/testdir/test_conceal.vim b/test/old/testdir/test_conceal.vim index 5448e9a991..a992baf008 100644 --- a/test/old/testdir/test_conceal.vim +++ b/test/old/testdir/test_conceal.vim @@ -148,7 +148,7 @@ func Test_conceal_with_cursorcolumn() \ "three |hidden| three three three three three three three three"] call setline(1, lines) set wrap linebreak - set showbreak=\ >>>\ + let &showbreak = ' >>> ' syntax match test /|hidden|/ conceal set conceallevel=2 set concealcursor= diff --git a/test/old/testdir/test_display.vim b/test/old/testdir/test_display.vim index 09f33cb2f2..4a0f56be3d 100644 --- a/test/old/testdir/test_display.vim +++ b/test/old/testdir/test_display.vim @@ -345,7 +345,7 @@ func Test_eob_fillchars() set fillchars=eob:+ redraw call assert_equal('+', Screenline(2)) - set fillchars=eob:\ + let &fillchars = 'eob: ' redraw call assert_equal(' ', nr2char(screenchar(2, 1))) set fillchars& @@ -416,7 +416,7 @@ func Test_fold_fillchars() call assert_equal(expected, lines) " check setting foldinner - set fillchars+=foldinner:\ + let &fillchars = &fillchars .. ',foldinner: ' let lines = ScreenLines([1, 6], 22) let expected = [ \ ' one ', diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 78810f64f4..ce0a45f808 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -3421,7 +3421,9 @@ endfunc func Test_ins_complete_end_of_line() " this was reading past the end of the line new - norm 8o€ý  + " Note that the 'space' at the end of the expression below is a non-breaking + " space, U+00a0. + execute "norm 8o€ý " sil! norm o bwipe! diff --git a/test/old/testdir/test_listchars.vim b/test/old/testdir/test_listchars.vim index d6a1be235c..279d10d57d 100644 --- a/test/old/testdir/test_listchars.vim +++ b/test/old/testdir/test_listchars.vim @@ -422,7 +422,7 @@ func Test_listchars() " Test leadtab with pipe character normal ggdG - set listchars=tab:>-,leadtab:\|\ + let &listchars = 'tab:>-,leadtab:| ' call append(0, ["\ttext"]) let expected = ['| text'] call Check_listchars(expected, 1, 12) @@ -430,7 +430,7 @@ func Test_listchars() " Test leadtab with unicode bar normal ggdG - set listchars=tab:>-,leadtab:│\ + let &listchars = 'tab:>-,leadtab:│ ' call append(0, ["\ttext"]) let expected = ['│ text'] call Check_listchars(expected, 1, 12) diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 7513c2fe16..18cbc0b20b 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -4447,6 +4447,7 @@ endfunc " " The problem occurred because WM_SETFOCUS was processed slowly, and typebuf " was not empty when it should have been. +" TODO: Is this test flaky? func Test_win32_gui_setfocus_prevent_showcmd() if !has('win32') || !has('gui_running') throw 'Skipped: Windows GUI regression test' diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index eb073d3628..4db7db2a49 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -518,7 +518,8 @@ func Test_smoothscroll_long_line_showbreak() vim9script # a line that spans four screen lines setline(1, 'with lots of text in one line '->repeat(6)) - set smoothscroll scrolloff=0 showbreak=+++\ + set smoothscroll scrolloff=0 + &showbreak = '+++ ' END call writefile(lines, 'XSmoothLongShowbreak', 'D') let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40}) diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 5fd2590b89..6db31af13a 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -167,7 +167,9 @@ func Test_sign() sign define Sign5 text=X\ linehl=Comment sign undefine Sign5 - sign define Sign5 linehl=Comment text=X\ + " The use of execute in the next line is just to ensure the space for + " the text value is obvious and does not get accidently deleted. + execute "sign define Sign5 linehl=Comment text=X\ " sign undefine Sign5 " define sign with backslash