Skip to content

Commit 679c2c0

Browse files
koronchrisbra
authored andcommitted
patch 9.1.2051: tests: fix Test_cd_completion fails in Appveyor
Problem: Test_cd_completion test fails in Appveyor. In Appveyor, a path containing spaces was selected as the test target. But the comparison failed because spaces were not taken into account (after v9.1.2050) Solution: Escape spaces in paths for comparison (Muraoka Taro) closes: #19087 Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 6625ba3 commit 679c2c0

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/testdir/test_cd.vim

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,22 +261,28 @@ func Test_cd_completion()
261261
let drive = full[0]
262262
call chdir(saved_cwd)
263263

264+
" Spaces are escaped in command line completion. Next, in assert_match(),
265+
" the backslash added by the first escape also needs to be escaped
266+
" separately, so the escape is doubled.
267+
let want_full = escape(escape(full, ' '), '\')
268+
let want_dir = escape(escape(dir, ' '), '\')
269+
264270
for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
265271
for sep in [ '/', '\']
266272

267273
" Explicit drive letter
268274
call feedkeys(':' .. cmd .. ' ' .. drive .. ':' .. sep ..
269275
\ partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
270-
call assert_match(full, @:)
276+
call assert_match(want_full, @:)
271277

272278
" Implicit drive letter
273279
call feedkeys(':' .. cmd .. ' ' .. sep .. partial .. "\<C-A>\<C-B>\"\<CR>", 'tx')
274-
call assert_match('/' .. dir .. '/', @:)
280+
call assert_match('/' .. want_dir .. '/', @:)
275281

276282
" UNC path
277283
call feedkeys(':' .. cmd .. ' ' .. sep .. sep .. $COMPUTERNAME .. sep ..
278284
\ drive .. '$' .. sep .. partial .."\<C-A>\<C-B>\"\<CR>", 'tx')
279-
call assert_match('//' .. $COMPUTERNAME .. '/' .. drive .. '$/' .. dir .. '/' , @:)
285+
call assert_match('//' .. $COMPUTERNAME .. '/' .. drive .. '$/' .. want_dir .. '/' , @:)
280286

281287
endfor
282288
endfor

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+
2051,
737739
/**/
738740
2050,
739741
/**/

0 commit comments

Comments
 (0)