diff src/testdir/test_quickfix.vim @ 9540:64a791c53418 v7.4.2050

commit https://github.com/vim/vim/commit/015102e91e978a0bb42a14461c132a85e8f7e1ea Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 16 18:24:56 2016 +0200 patch 7.4.2050 Problem: When using ":vimgrep" may end up with duplicate buffers. Solution: When adding an error list entry pass the buffer number if possible.
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Jul 2016 18:45:04 +0200
parents 26da1efa9e46
children ccbd2e604e59
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1462,3 +1462,18 @@ func Test_history()
   call HistoryTest('c')
   call HistoryTest('l')
 endfunc
+
+func Test_duplicate_buf()
+  " make sure we can get the highest buffer number
+  edit DoesNotExist
+  edit DoesNotExist2
+  let last_buffer = bufnr("$")
+
+  " make sure only one buffer is created
+  call writefile(['this one', 'that one'], 'Xgrepthis')
+  vimgrep one Xgrepthis
+  vimgrep one Xgrepthis
+  call assert_equal(last_buffer + 1, bufnr("$"))
+
+  call delete('Xgrepthis')
+endfunc