diff src/testdir/test_quickfix.vim @ 9850:67781bb0a61a v7.4.2200

commit https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 12 16:29:27 2016 +0200 patch 7.4.2200 Problem: Cannot get all information about a quickfix list. Solution: Add an optional argument to get/set loc/qf list(). (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Fri, 12 Aug 2016 16:30:07 +0200
parents 429be545637a
children e24aa20d815c
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1505,3 +1505,42 @@ func Test_duplicate_buf()
 
   call delete('Xgrepthis')
 endfunc
+
+" Quickfix/Location list set/get properties tests
+function Xproperty_tests(cchar)
+    call s:setup_commands(a:cchar)
+
+    " Error cases
+    call assert_fails('call g:Xgetlist(99)', 'E715:')
+    call assert_fails('call g:Xsetlist(99)', 'E714:')
+    call assert_fails('call g:Xsetlist([], "a", [])', 'E715:')
+
+    " Set and get the title
+    Xopen
+    wincmd p
+    call g:Xsetlist([{'filename':'foo', 'lnum':27}])
+    call g:Xsetlist([], 'a', {'title' : 'Sample'})
+    let d = g:Xgetlist({"title":1})
+    call assert_equal('Sample', d.title)
+
+    Xopen
+    call assert_equal('Sample', w:quickfix_title)
+    Xclose
+
+    " Invalid arguments
+    call assert_fails('call g:Xgetlist([])', 'E715')
+    call assert_fails('call g:Xsetlist([], "a", [])', 'E715')
+    let s = g:Xsetlist([], 'a', {'abc':1})
+    call assert_equal(-1, s)
+
+    call assert_equal({}, g:Xgetlist({'abc':1}))
+
+    if a:cchar == 'l'
+	call assert_equal({}, getloclist(99, ['title']))
+    endif
+endfunction
+
+function Test_qf_property()
+    call Xproperty_tests('c')
+    call Xproperty_tests('l')
+endfunction