diff src/testdir/test_quickfix.vim @ 14491:9df0fcbfebb2 v8.1.0259

patch 8.1.0259: no test for fixed quickfix issue commit https://github.com/vim/vim/commit/3f347e4716c44cf6458be407e712e3d708d82580 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 9 21:19:20 2018 +0200 patch 8.1.0259: no test for fixed quickfix issue Problem: No test for fixed quickfix issue. Solution: Add a test. Clean up the code a bit. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Thu, 09 Aug 2018 21:30:05 +0200
parents 19d99d9e670c
children b298737a7188
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -3478,6 +3478,30 @@ func Xautocmd_changelist(cchar)
   call assert_equal(5, line('.'))
   autocmd! QuickFixCmdPost
 
+  " Test for autocommands clearing the quickfix list before jumping to the
+  " first error. This should not result in an error
+  autocmd QuickFixCmdPost * call g:Xsetlist([], 'r')
+  let v:errmsg = ''
+  " Test for cfile/lfile
+  Xfile Xerr
+  call assert_true(v:errmsg !~# 'E42:')
+  " Test for cbuffer/lbuffer
+  edit Xerr
+  Xbuffer
+  call assert_true(v:errmsg !~# 'E42:')
+  " Test for cexpr/lexpr
+  Xexpr 'Xtestfile2:4:Line4'
+  call assert_true(v:errmsg !~# 'E42:')
+  " Test for grep/lgrep
+  " The grepprg may not be set on non-Unix systems
+  if has('unix')
+    silent Xgrep Line5 Xtestfile2
+    call assert_true(v:errmsg !~# 'E42:')
+  endif
+  " Test for vimgrep/lvimgrep
+  call assert_fails('silent Xvimgrep Line5 Xtestfile2', 'E480:')
+  autocmd! QuickFixCmdPost
+
   call delete('Xerr')
   call delete('Xtestfile1')
   call delete('Xtestfile2')