diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-12 16:29:27 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-12 16:29:27 +0200 |
commit | d823fa910cca43fec3c31c030ee908a14c272640 (patch) | |
tree | 3584f177ff749708f006f8f8c3467dff95cc9f97 /src/testdir/test_quickfix.vim | |
parent | 107abd2ca53c31fd3bb40d77ff296e98eaae2975 (diff) | |
download | vim-git-d823fa910cca43fec3c31c030ee908a14c272640.tar.gz |
patch 7.4.2200v7.4.2200
Problem: Cannot get all information about a quickfix list.
Solution: Add an optional argument to get/set loc/qf list(). (Yegappan
Lakshmanan)
Diffstat (limited to 'src/testdir/test_quickfix.vim')
-rw-r--r-- | src/testdir/test_quickfix.vim | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 9f0b5106e..b7d985d0d 100644 --- 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 |