]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0498: two autocmd tests are skipped on MS-Windows v8.0.0498
authorBram Moolenaar <Bram@vim.org>
Tue, 21 Mar 2017 14:50:12 +0000 (15:50 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 21 Mar 2017 14:50:12 +0000 (15:50 +0100)
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().

src/testdir/test_autocmd.vim
src/version.c

index 9e0ecbe902c8f5eae331556ad5c24fa8e4aca1b0..ef280340cc268b7c43d9dd6bbdac6a0f4f0e0377 100644 (file)
@@ -340,7 +340,10 @@ func Test_BufEnter()
   call mkdir('Xdir')
   split Xdir
   call assert_equal('+++', g:val)
-  bwipe!
+
+  " On MS-Windows we can't edit the directory, make sure we wipe the right
+  " buffer.
+  bwipe! Xdir
 
   call delete('Xdir', 'd')
   au! BufEnter
@@ -349,40 +352,37 @@ endfunc
 " Closing a window might cause an endless loop
 " E814 for older Vims
 function Test_autocmd_bufwipe_in_SessLoadPost()
-  if has('win32')
-    throw 'Skipped: test hangs on MS-Windows'
-  endif
   tabnew
   set noswapfile
-  let g:bufnr=bufnr('%')
   mksession!
 
-  let content=['set nocp noswapfile',
+  let content = ['set nocp noswapfile',
         \ 'let v:swapchoice="e"',
         \ 'augroup test_autocmd_sessionload',
         \ 'autocmd!',
         \ 'autocmd SessionLoadPost * 4bw!',
-        \ 'augroup END'
+        \ 'augroup END',
+       \ '',
+       \ 'func WriteErrors()',
+       \ '  call writefile([execute("messages")], "Xerrors")',
+       \ 'endfunc',
+       \ 'au VimLeave * call WriteErrors()',
         \ ]
   call writefile(content, 'Xvimrc')
-  let a=system(v:progpath. ' -u Xvimrc --noplugins -S Session.vim')
-  call assert_match('E814', a)
+  call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
+  let errors = join(readfile('Xerrors'))
+  call assert_match('E814', errors)
 
-  unlet! g:bufnr
   set swapfile
-  for file in ['Session.vim', 'Xvimrc']
+  for file in ['Session.vim', 'Xvimrc', 'Xerrors']
     call delete(file)
   endfor
 endfunc
 
 " SEGV occurs in older versions.
 function Test_autocmd_bufwipe_in_SessLoadPost2()
-  if has('win32')
-    throw 'Skipped: test hangs on MS-Windows'
-  endif
   tabnew
   set noswapfile
-  let g:bufnr=bufnr('%')
   mksession!
 
   let content = ['set nocp noswapfile',
@@ -397,20 +397,24 @@ function Test_autocmd_bufwipe_in_SessLoadPost2()
       \ '      exec ''bwipeout '' . b',
       \ '    endif',
       \ '  endfor',
-      \ 'call append("1", "SessionLoadPost DONE")',
+      \ '  echomsg "SessionLoadPost DONE"',
       \ 'endfunction',
-      \ 'au SessionLoadPost * call DeleteInactiveBufs()']
+      \ 'au SessionLoadPost * call DeleteInactiveBufs()',
+      \ '',
+      \ 'func WriteErrors()',
+      \ '  call writefile([execute("messages")], "Xerrors")',
+      \ 'endfunc',
+      \ 'au VimLeave * call WriteErrors()',
+      \ ]
   call writefile(content, 'Xvimrc')
-  let a=system(v:progpath. ' -u Xvimrc --noplugins -S Session.vim')
-  " this probably only matches on unix
-  if has("unix")
-    call assert_notmatch('Caught deadly signal SEGV', a)
-  endif
-  call assert_match('SessionLoadPost DONE', a)
-
-  unlet! g:bufnr
+  call system(v:progpath. ' -u Xvimrc --not-a-term --noplugins -S Session.vim -c cq')
+  let errors = join(readfile('Xerrors'))
+  " This probably only ever matches on unix.
+  call assert_notmatch('Caught deadly signal SEGV', errors)
+  call assert_match('SessionLoadPost DONE', errors)
+
   set swapfile
-  for file in ['Session.vim', 'Xvimrc']
+  for file in ['Session.vim', 'Xvimrc', 'Xerrors']
     call delete(file)
   endfor
 endfunc
index 88fd23d3a30354807ff6a8fdb18a45034fd3bff4..ba8ff84d181642808f5252c7b4471fdb9b4ae806 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    498,
 /**/
     497,
 /**/