Skip to content

Commit e94260f

Browse files
committed
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
Problem: Two autocmd tests are skipped on MS-Windows. Solution: Make the test pass on MS-Windows. Write the messages in a file instead of getting the output of system().
1 parent 3ff2f09 commit e94260f

2 files changed

Lines changed: 32 additions & 26 deletions

File tree

src/testdir/test_autocmd.vim

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ func Test_BufEnter()
340340
call mkdir('Xdir')
341341
split Xdir
342342
call assert_equal('+++', g:val)
343-
bwipe!
343+
344+
" On MS-Windows we can't edit the directory, make sure we wipe the right
345+
" buffer.
346+
bwipe! Xdir
344347

345348
call delete('Xdir', 'd')
346349
au! BufEnter
@@ -349,40 +352,37 @@ endfunc
349352
" Closing a window might cause an endless loop
350353
" E814 for older Vims
351354
function Test_autocmd_bufwipe_in_SessLoadPost()
352-
if has('win32')
353-
throw 'Skipped: test hangs on MS-Windows'
354-
endif
355355
tabnew
356356
set noswapfile
357-
let g:bufnr=bufnr('%')
358357
mksession!
359358

360-
let content=['set nocp noswapfile',
359+
let content = ['set nocp noswapfile',
361360
\ 'let v:swapchoice="e"',
362361
\ 'augroup test_autocmd_sessionload',
363362
\ 'autocmd!',
364363
\ 'autocmd SessionLoadPost * 4bw!',
365-
\ 'augroup END'
364+
\ 'augroup END',
365+
\ '',
366+
\ 'func WriteErrors()',
367+
\ ' call writefile([execute("messages")], "Xerrors")',
368+
\ 'endfunc',
369+
\ 'au VimLeave * call WriteErrors()',
366370
\ ]
367371
call writefile(content, 'Xvimrc')
368-
let a=system(v:progpath. ' -u Xvimrc --noplugins -S Session.vim')
369-
call assert_match('E814', a)
372+
call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
373+
let errors = join(readfile('Xerrors'))
374+
call assert_match('E814', errors)
370375

371-
unlet! g:bufnr
372376
set swapfile
373-
for file in ['Session.vim', 'Xvimrc']
377+
for file in ['Session.vim', 'Xvimrc', 'Xerrors']
374378
call delete(file)
375379
endfor
376380
endfunc
377381

378382
" SEGV occurs in older versions.
379383
function Test_autocmd_bufwipe_in_SessLoadPost2()
380-
if has('win32')
381-
throw 'Skipped: test hangs on MS-Windows'
382-
endif
383384
tabnew
384385
set noswapfile
385-
let g:bufnr=bufnr('%')
386386
mksession!
387387

388388
let content = ['set nocp noswapfile',
@@ -397,20 +397,24 @@ function Test_autocmd_bufwipe_in_SessLoadPost2()
397397
\ ' exec ''bwipeout '' . b',
398398
\ ' endif',
399399
\ ' endfor',
400-
\ 'call append("1", "SessionLoadPost DONE")',
400+
\ ' echomsg "SessionLoadPost DONE"',
401401
\ 'endfunction',
402-
\ 'au SessionLoadPost * call DeleteInactiveBufs()']
402+
\ 'au SessionLoadPost * call DeleteInactiveBufs()',
403+
\ '',
404+
\ 'func WriteErrors()',
405+
\ ' call writefile([execute("messages")], "Xerrors")',
406+
\ 'endfunc',
407+
\ 'au VimLeave * call WriteErrors()',
408+
\ ]
403409
call writefile(content, 'Xvimrc')
404-
let a=system(v:progpath. ' -u Xvimrc --noplugins -S Session.vim')
405-
" this probably only matches on unix
406-
if has("unix")
407-
call assert_notmatch('Caught deadly signal SEGV', a)
408-
endif
409-
call assert_match('SessionLoadPost DONE', a)
410-
411-
unlet! g:bufnr
410+
call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
411+
let errors = join(readfile('Xerrors'))
412+
" This probably only ever matches on unix.
413+
call assert_notmatch('Caught deadly signal SEGV', errors)
414+
call assert_match('SessionLoadPost DONE', errors)
415+
412416
set swapfile
413-
for file in ['Session.vim', 'Xvimrc']
417+
for file in ['Session.vim', 'Xvimrc', 'Xerrors']
414418
call delete(file)
415419
endfor
416420
endfunc

src/version.c

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

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
498,
767769
/**/
768770
497,
769771
/**/

0 commit comments

Comments
 (0)