diff src/testdir/test_quickfix.vim @ 12252:3d0e042ec13c v8.0.1006

patch 8.0.1006: quickfix list changes when parsing text with 'erroformat' commit https://github.com/vim/vim/commit/7adf06f4e25c795ba32ff0b2e8591330f6a41afb Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 27 15:23:41 2017 +0200 patch 8.0.1006: quickfix list changes when parsing text with 'erroformat' Problem: Cannot parse text with 'erroformat' without changing a quickfix list. Solution: Add the "text" argument to getqflist(). (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Sun, 27 Aug 2017 15:30:05 +0200
parents 69ce6b3f0834
children 20641a7e1fc9
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -2519,3 +2519,29 @@ func Test_add_qf()
   call XaddQf_tests('c')
   call XaddQf_tests('l')
 endfunc
+
+" Test for getting the quickfix list items from some text without modifying
+" the quickfix stack
+func XgetListFromText(cchar)
+  call s:setup_commands(a:cchar)
+  call g:Xsetlist([], 'f')
+
+  let l = g:Xgetlist({'text' : "File1:10:Line10"}).items
+  call assert_equal(1, len(l))
+  call assert_equal('Line10', l[0].text)
+
+  let l = g:Xgetlist({'text' : ["File2:20:Line20", "File2:30:Line30"]}).items
+  call assert_equal(2, len(l))
+  call assert_equal(30, l[1].lnum)
+
+  call assert_equal({}, g:Xgetlist({'text' : 10}))
+  call assert_equal({}, g:Xgetlist({'text' : []}))
+
+  " Make sure that the quickfix stack is not modified
+  call assert_equal(0, g:Xgetlist({'nr' : '$'}).nr)
+endfunc
+
+func Test_get_list_from_text()
+  call XgetListFromText('c')
+  call XgetListFromText('l')
+endfunc