Skip to content

Commit 211ceea

Browse files
paul-ollischrisbra
authored andcommitted
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: #19838 Signed-off-by: Paul Ollis <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent b8a653a commit 211ceea

10 files changed

Lines changed: 19 additions & 11 deletions

src/testdir/test_conceal.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func Test_conceal_with_cursorcolumn()
148148
\ "three |hidden| three three three three three three three three"]
149149
call setline(1, lines)
150150
set wrap linebreak
151-
set showbreak=\ >>>\
151+
let &showbreak = ' >>> '
152152
syntax match test /|hidden|/ conceal
153153
set conceallevel=2
154154
set concealcursor=

src/testdir/test_display.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func Test_eob_fillchars()
342342
set fillchars=eob:+
343343
redraw
344344
call assert_equal('+', Screenline(2))
345-
set fillchars=eob:\
345+
let &fillchars = 'eob: '
346346
redraw
347347
call assert_equal(' ', nr2char(screenchar(2, 1)))
348348
set fillchars&
@@ -413,7 +413,7 @@ func Test_fold_fillchars()
413413
call assert_equal(expected, lines)
414414

415415
" check setting foldinner
416-
set fillchars+=foldinner:\
416+
let &fillchars = &fillchars .. ',foldinner: '
417417
let lines = ScreenLines([1, 6], 22)
418418
let expected = [
419419
\ ' one ',

src/testdir/test_ins_complete.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3311,7 +3311,9 @@ endfunc
33113311
func Test_ins_complete_end_of_line()
33123312
" this was reading past the end of the line
33133313
new
3314-
norm 8o€ý 
3314+
" Note that the 'space' at the end of the expression below is a non-breaking
3315+
" space, U+00a0.
3316+
execute "norm 8o€ý "
33153317
sil! norm o
33163318

33173319
bwipe!

src/testdir/test_listchars.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,15 @@ func Test_listchars()
420420

421421
" Test leadtab with pipe character
422422
normal ggdG
423-
set listchars=tab:>-,leadtab:\|\
423+
let &listchars = 'tab:>-,leadtab:| '
424424
call append(0, ["\ttext"])
425425
let expected = ['| text']
426426
call Check_listchars(expected, 1, 12)
427427
call assert_equal(expected + [' '], split(execute("%list"), "\n"))
428428

429429
" Test leadtab with unicode bar
430430
normal ggdG
431-
set listchars=tab:>-,leadtab:\
431+
let &listchars = 'tab:>-,leadtab:│ '
432432
call append(0, ["\ttext"])
433433
let expected = ['│ text']
434434
call Check_listchars(expected, 1, 12)

src/testdir/test_normal.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4434,6 +4434,7 @@ endfunc
44344434
"
44354435
" The problem occurred because WM_SETFOCUS was processed slowly, and typebuf
44364436
" was not empty when it should have been.
4437+
" TODO: Is this test flaky?
44374438
func Test_win32_gui_setfocus_prevent_showcmd()
44384439
if !has('win32') || !has('gui_running')
44394440
throw 'Skipped: Windows GUI regression test'

src/testdir/test_popupwin.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ func Test_popup_with_showbreak()
11651165
CheckScreendump
11661166

11671167
let lines =<< trim END
1168-
set showbreak=>>\
1168+
let &showbreak ='>> '
11691169
call setline(1, range(1, 20))
11701170
let winid = popup_dialog(
11711171
\ 'a long line here that wraps',

src/testdir/test_scroll_opt.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ func Test_smoothscroll_long_line_showbreak()
517517
vim9script
518518
# a line that spans four screen lines
519519
setline(1, 'with lots of text in one line '->repeat(6))
520-
set smoothscroll scrolloff=0 showbreak=+++\
520+
set smoothscroll scrolloff=0
521+
&showbreak = '+++ '
521522
END
522523
call writefile(lines, 'XSmoothLongShowbreak', 'D')
523524
let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40})

src/testdir/test_signs.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ func Test_sign()
165165

166166
sign define Sign5 text=X\ linehl=Comment
167167
sign undefine Sign5
168-
sign define Sign5 linehl=Comment text=X\
168+
" The use of execute in the next line is just to ensure the space for
169+
" the text value is obvious and does not get accidently deleted.
170+
execute "sign define Sign5 linehl=Comment text=X\ "
169171
sign undefine Sign5
170172

171173
" define sign with backslash

src/testdir/test_textprop.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3606,7 +3606,7 @@ func Test_props_with_text_below_nowrap()
36063606
vim9script
36073607
edit foobar
36083608
set nowrap
3609-
set showbreak=+++\
3609+
set showbreak=+++
36103610
setline(1, ['onasdf asdf asdf sdf df asdf asdf e asdf asdf asdf asdf asd fas df', 'two'])
36113611
prop_type_add('test', {highlight: 'Special'})
36123612
prop_add(1, 0, {
@@ -4273,7 +4273,7 @@ func Test_text_after_wrap_showbreak()
42734273
set shiftwidth=4
42744274

42754275
set breakindent
4276-
set showbreak=>\
4276+
let &showbreak = '> '
42774277
set breakindentopt=shift:2,min:64
42784278

42794279
call setline(1, [' " 1234567890', 'foo', 'bar'])

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
270,
737739
/**/
738740
269,
739741
/**/

0 commit comments

Comments
 (0)