Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 11223:ac36e139510f v8.0.0498
patch 8.0.0498: two autocmd tests are skipped on MS-Windows
commit https://github.com/vim/vim/commit/e94260f3582cf928cc59e792b3b6ede57794a4a6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 21 15:50:12 2017 +0100
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().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 21 Mar 2017 16:00:05 +0100 |
parents | 87ef152072d4 |
children | dbce7e03bf55 |
comparison
equal
deleted
inserted
replaced
11222:ce7d9528e4ca | 11223:ac36e139510f |
---|---|
338 | 338 |
339 " Also get BufEnter when editing a directory | 339 " Also get BufEnter when editing a directory |
340 call mkdir('Xdir') | 340 call mkdir('Xdir') |
341 split Xdir | 341 split Xdir |
342 call assert_equal('+++', g:val) | 342 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 | |
344 | 347 |
345 call delete('Xdir', 'd') | 348 call delete('Xdir', 'd') |
346 au! BufEnter | 349 au! BufEnter |
347 endfunc | 350 endfunc |
348 | 351 |
349 " Closing a window might cause an endless loop | 352 " Closing a window might cause an endless loop |
350 " E814 for older Vims | 353 " E814 for older Vims |
351 function Test_autocmd_bufwipe_in_SessLoadPost() | 354 function Test_autocmd_bufwipe_in_SessLoadPost() |
352 if has('win32') | |
353 throw 'Skipped: test hangs on MS-Windows' | |
354 endif | |
355 tabnew | 355 tabnew |
356 set noswapfile | 356 set noswapfile |
357 let g:bufnr=bufnr('%') | |
358 mksession! | 357 mksession! |
359 | 358 |
360 let content=['set nocp noswapfile', | 359 let content = ['set nocp noswapfile', |
361 \ 'let v:swapchoice="e"', | 360 \ 'let v:swapchoice="e"', |
362 \ 'augroup test_autocmd_sessionload', | 361 \ 'augroup test_autocmd_sessionload', |
363 \ 'autocmd!', | 362 \ 'autocmd!', |
364 \ 'autocmd SessionLoadPost * 4bw!', | 363 \ '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()', | |
366 \ ] | 370 \ ] |
367 call writefile(content, 'Xvimrc') | 371 call writefile(content, 'Xvimrc') |
368 let a=system(v:progpath. ' -u Xvimrc --noplugins -S Session.vim') | 372 call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') |
369 call assert_match('E814', a) | 373 let errors = join(readfile('Xerrors')) |
370 | 374 call assert_match('E814', errors) |
371 unlet! g:bufnr | 375 |
372 set swapfile | 376 set swapfile |
373 for file in ['Session.vim', 'Xvimrc'] | 377 for file in ['Session.vim', 'Xvimrc', 'Xerrors'] |
374 call delete(file) | 378 call delete(file) |
375 endfor | 379 endfor |
376 endfunc | 380 endfunc |
377 | 381 |
378 " SEGV occurs in older versions. | 382 " SEGV occurs in older versions. |
379 function Test_autocmd_bufwipe_in_SessLoadPost2() | 383 function Test_autocmd_bufwipe_in_SessLoadPost2() |
380 if has('win32') | |
381 throw 'Skipped: test hangs on MS-Windows' | |
382 endif | |
383 tabnew | 384 tabnew |
384 set noswapfile | 385 set noswapfile |
385 let g:bufnr=bufnr('%') | |
386 mksession! | 386 mksession! |
387 | 387 |
388 let content = ['set nocp noswapfile', | 388 let content = ['set nocp noswapfile', |
389 \ 'function! DeleteInactiveBufs()', | 389 \ 'function! DeleteInactiveBufs()', |
390 \ ' tabfirst', | 390 \ ' tabfirst', |
395 \ ' for b in range(1, bufnr(''$''))', | 395 \ ' for b in range(1, bufnr(''$''))', |
396 \ ' if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')', | 396 \ ' if bufexists(b) && buflisted(b) && (index(tabblist, b) == -1 || bufname(b) =~# ''^$'')', |
397 \ ' exec ''bwipeout '' . b', | 397 \ ' exec ''bwipeout '' . b', |
398 \ ' endif', | 398 \ ' endif', |
399 \ ' endfor', | 399 \ ' endfor', |
400 \ 'call append("1", "SessionLoadPost DONE")', | 400 \ ' echomsg "SessionLoadPost DONE"', |
401 \ 'endfunction', | 401 \ '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 \ ] | |
403 call writefile(content, 'Xvimrc') | 409 call writefile(content, 'Xvimrc') |
404 let a=system(v:progpath. ' -u Xvimrc --noplugins -S Session.vim') | 410 call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq') |
405 " this probably only matches on unix | 411 let errors = join(readfile('Xerrors')) |
406 if has("unix") | 412 " This probably only ever matches on unix. |
407 call assert_notmatch('Caught deadly signal SEGV', a) | 413 call assert_notmatch('Caught deadly signal SEGV', errors) |
408 endif | 414 call assert_match('SessionLoadPost DONE', errors) |
409 call assert_match('SessionLoadPost DONE', a) | 415 |
410 | |
411 unlet! g:bufnr | |
412 set swapfile | 416 set swapfile |
413 for file in ['Session.vim', 'Xvimrc'] | 417 for file in ['Session.vim', 'Xvimrc', 'Xerrors'] |
414 call delete(file) | 418 call delete(file) |
415 endfor | 419 endfor |
416 endfunc | 420 endfunc |