Mercurial > vim
changeset 9258:7e403edce82f v7.4.1912
commit https://github.com/vim/vim/commit/1cee693b310e1494115a1677fac064941092e1bb
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 9 22:17:22 2016 +0200
patch 7.4.1912
Problem: No test for using setqflist() on an older quickfix list.
Solution: Add a couple of tests.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 09 Jun 2016 22:30:05 +0200 |
parents | bad6fcce0446 |
children | efb4c1cb6ca8 |
files | src/testdir/test_quickfix.vim src/version.c |
diffstat | 2 files changed, 45 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -752,9 +752,52 @@ function Test_setqflist() call SetXlistTests('c', bnum) call SetXlistTests('l', bnum) + enew! call delete('Xtestfile') endfunction +func Test_setqflist_empty_middle() + " create three quickfix lists + vimgrep Test_ test_quickfix.vim + let testlen = len(getqflist()) + call assert_true(testlen > 0) + vimgrep empty test_quickfix.vim + call assert_true(len(getqflist()) > 0) + vimgrep matches test_quickfix.vim + let matchlen = len(getqflist()) + call assert_true(matchlen > 0) + colder + " make the middle list empty + call setqflist([], 'r') + call assert_true(len(getqflist()) == 0) + colder + call assert_equal(testlen, len(getqflist())) + cnewer + cnewer + call assert_equal(matchlen, len(getqflist())) +endfunc + +func Test_setqflist_empty_older() + " create three quickfix lists + vimgrep one test_quickfix.vim + let onelen = len(getqflist()) + call assert_true(onelen > 0) + vimgrep two test_quickfix.vim + let twolen = len(getqflist()) + call assert_true(twolen > 0) + vimgrep three test_quickfix.vim + let threelen = len(getqflist()) + call assert_true(threelen > 0) + colder 2 + " make the first list empty, check the others didn't change + call setqflist([], 'r') + call assert_true(len(getqflist()) == 0) + cnewer + call assert_equal(twolen, len(getqflist())) + cnewer + call assert_equal(threelen, len(getqflist())) +endfunc + function! XquickfixSetListWithAct(cchar) let Xolder = a:cchar . 'older' let Xnewer = a:cchar . 'newer'